动态添加的checkbox始终第一个赋不到值!
我想动态创建3个checkbox,但是下面的代码却创建了4个checkbox! 而且发现创建后 msgbox Check1(0).Tag 始终是空的! 并不是想象中的得到 Test0! 我设置了Checkbox1空间的index是0. 应该如何改创建3个checkbox,而且第一个 checkbox的Tag值是 Test0??
Private Sub Form_Load()Dim i As Integer For i = 1 To 3 Load Check1(i) Check1(i).Caption = "Check" & CStr(i + 1) Check1(i).Top = Check1(i - 1).Top + 500 Check1(i).Left = Check1(0).Left Check1(i).Visible = True Check1(i).Tag = "Test" & CStr(i) Next End Sub
Private Sub Form_Load() Dim i As Integer Check1(0).Tag = "Test0" For i = 1 To 3 Load Check1(i) Check1(i).Caption = "Check" & CStr(i + 1) Check1(i).Top = Check1(i - 1).Top + 500 Check1(i).Left = Check1(0).Left Check1(i).Visible = True Check1(i).Tag = "Test" & CStr(i) Next End Sub