如题:
控件数组在窗体设计的时候已经创建好了。 text1(5)
然后后面动态添加的控件,都为控件数组的text1(5)里的,试了半天还是不会,请教。
Private Sub Command6_Click()ReDim Preserve Text1(Text1.Count + 1)
Set newtxt = Controls.Add("VB.TextBox", "Text1", Frame1)
With newtxt
.Visible = True
.Enabled = True
End With
MsgBox newtxt.Name
'Set 其他控件 = Controls.Add("VB.TextBox", newtxt)
End Sub
控件数组在窗体设计的时候已经创建好了。 text1(5)
然后后面动态添加的控件,都为控件数组的text1(5)里的,试了半天还是不会,请教。
Private Sub Command6_Click()ReDim Preserve Text1(Text1.Count + 1)
Set newtxt = Controls.Add("VB.TextBox", "Text1", Frame1)
With newtxt
.Visible = True
.Enabled = True
End With
MsgBox newtxt.Name
'Set 其他控件 = Controls.Add("VB.TextBox", newtxt)
End Sub
Dim i As Integer
i = Text1.UBound + 1
Load Text1(i)
With Text1(i)
.Visible = True
.Enabled = True
.Left = Text1(i - 1).Left
.Top = Text1(i - 1).Top + 500
End With
MsgBox Text1(i).Name
End Sub
老马多了个奖章,,,MVP