销毁 unload image(3) ----------- Private Sub Command1_Click() Load Text1(1) Text1(1).Left = 200 Text1(1).Top = 200 Text1(1).Visible = True End SubPrivate Sub Command2_Click() Unload Text1(1) End Sub
遍历所有控件,包括控件数组Private Sub Command3_Click() Dim x As VB.Control For Each x In Me.Controls If VBA.VarType(VBA.CallByName(Me, x.Name, VbGet)) = vbObject Then '控件数组 Debug.Print x.Name & ".Item(" & x.Index & ")" Else Debug.Print x.Name End If Next xEnd Sub
同意楼上一位大牛哥的,我说个简单的,楼上说的对于我们初学者有点难! Option ExplicitPrivate Sub Command1_Click() Dim i As Integer For i = 0 To Form1.Controls.Count - 1 If TypeName(Form1.Controls(i)) = "TextBox" Then If Form1.Controls(i).Index = 2 Then
Unload Text1(2) End If End If Next i
End SubPrivate Sub Form_Load() Load Text1(2) Text1(2).Left = 200 Text1(2).Top = 200 Text1(2).Visible = TrueEnd Sub
销毁就用unload(image(3))应该可以
unload image(3)
-----------
Private Sub Command1_Click()
Load Text1(1)
Text1(1).Left = 200
Text1(1).Top = 200
Text1(1).Visible = True
End SubPrivate Sub Command2_Click()
Unload Text1(1)
End Sub
Dim x As VB.Control
For Each x In Me.Controls
If VBA.VarType(VBA.CallByName(Me, x.Name, VbGet)) = vbObject Then '控件数组
Debug.Print x.Name & ".Item(" & x.Index & ")"
Else
Debug.Print x.Name
End If
Next xEnd Sub
Option ExplicitPrivate Sub Command1_Click()
Dim i As Integer
For i = 0 To Form1.Controls.Count - 1
If TypeName(Form1.Controls(i)) = "TextBox" Then
If Form1.Controls(i).Index = 2 Then
Unload Text1(2)
End If
End If
Next i
End SubPrivate Sub Form_Load() Load Text1(2)
Text1(2).Left = 200
Text1(2).Top = 200
Text1(2).Visible = TrueEnd Sub