'首先在窗口中加一个Text控件,将其Index属性设置为0'加载10个控件 Private Sub Command1_Click() Dim i As Long Dim lngIndex As Long
For i = 1 To 10 lngIndex = Text1.UBound + 1 Load Text1(lngIndex) Text1(lngIndex).Top = Text1(lngIndex - 1).Top + Text1(lngIndex - 1).Height + 100 Text1(lngIndex).Left = Text1(lngIndex - 1).Left Text1(lngIndex - 1).Visible = True Next End Sub'卸载控件 Private Sub Command2_Click() Dim i As Long Dim lngCount As Long lngCount = Text1.UBound
For i = 1 To lngCount Unload Text1(i) Next End Sub
Private Sub Command1_Click()
Dim i As Long
Dim lngIndex As Long
For i = 1 To 10
lngIndex = Text1.UBound + 1
Load Text1(lngIndex)
Text1(lngIndex).Top = Text1(lngIndex - 1).Top + Text1(lngIndex - 1).Height + 100
Text1(lngIndex).Left = Text1(lngIndex - 1).Left
Text1(lngIndex - 1).Visible = True
Next
End Sub'卸载控件
Private Sub Command2_Click()
Dim i As Long
Dim lngCount As Long
lngCount = Text1.UBound
For i = 1 To lngCount
Unload Text1(i)
Next
End Sub
Private Sub Combo1_Change()
Unload Me.Cmd2(5)
End Sub
问题依旧,还是提示“不能在该上下文中卸载”,不知是什么意思。