请问我该如何引用用代码创建的text
For j = 1 To10Set T = Me.Controls.Add("VB.textbox", "Text" & j)
T.Text = ""
T.Visible = True
T.Width = 2000
T.Left = 3700
T.Top = 700 * j+ 800
T.Height = 200
T.FontSize = 10
Next j
(然后我该如何引用之前的text呢)
Dim Text() As Object '在通用部分声明数组控件对象 Private Sub Command1_Click() '在按钮事件中可以操作数组控件,下面是给文本框数组的部分控件重新赋值 Text(1).Text = "abc" Text(2).Text = "cde" '......................... Text(10).Text = "xyz" End Sub Private Sub Form_Load() Dim J As Integer ReDim Text(1 To 10) '对数组控件定义下标 For J = 1 To 10 Set Text(J) = Me.Controls.Add("VB.TextBox", "Text1" & CStr(J)) '设置控件 Text(J).Text = J '提前赋值 Text(J).Visible = True Text(J).Width = 1000 Text(J).Left = 3700 Text(J).Top = 400 * J + 200 Text(J).Height = 60 Text(J).FontSize = 12 Next J End Sub
[此贴子已经被作者于2019-3-10 13:10编辑过]