本文介绍了从代码添加文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Visual Studio 2010中使用Visual Basic.如何从代码内将文本框添加到表单?
I''m using Visual Basic in Visual Studio 2010. How do I add a textbox to a form from within the code?
推荐答案
Dim TextBox1 As TextBox = New TextBox
With TextBox1
.Top = 8
.Left = 16
'set the other properties
End With
More at MSDN[^] site.
Public Class Form1
Dim lowerBound As Double
Dim textBoxes(4) As TextBox
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
TextBox1.AppendText("sales")
textBoxes(1) = New TextBox()
With textBoxes(1)
.Top = 60
.Left = 17
.Height = 20
.Width = 104
.Visible = True
.ForeColor = Color.Black
.BackColor = Color.Transparent
.AcceptsReturn = False
End With
End Sub
这篇关于从代码添加文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!