# 谢谢你们的帮助,我把它写出来了,顺便供你们参考

Posted by Jonny on May 16, 1999 at 00:53:28:

In Reply to: 那这样跟二维阵列好像没关系ㄝ :P (无内文) posted by 小翰 on May 15, 1999 at 00:12:23:

Sub Cls_Object(Index As String)
' if index = "T" then clear TextBox.Text
' if index = "L" then clear Lable.Caption
' if index = "LST" OR "C" then clear ListBox or ComboBox
' if index = "CHK" OR "O" then clear CheckBox or OptionButton
Dim vtype As String
For Each Control In Form1.Controls
vtype = TypeName(Control)
If (vtype = "TextBox" And Index = "T") Then
Control.Text = ""
ElseIf vtype = "Label" And Index = "L" Then
Control.Caption = ""
ElseIf (vtype = "ListBox" And Index = "LST") Or (vtype = "ComboBox" And Index = "C") Then
Control.Clear
ElseIf (vtype = "CheckBox" And Index = "CHK") Or (vtype = "OptionButton" And Index = "O") Then
Control.Value = False
End If
Next Control
End Sub

如果还有更好的方法请告知,感谢你的帮助~

Follow Ups: