这是很简单的问题呀。 'Class1.cls Private WithEvents txt As TextBox Property Set TextBox(obj As Object) Set txt=obj End Property Private Sub txt_Change() if not IsNumeric(txt) then txt="" End Sub'Form1 Dim clstxt1 As New Class1 Private Sub Form_Load() dim i as long for i=0 to 1 set clstxt1.TextBox=Me.Text1(i) next End Sub
'Class1.cls
Private WithEvents txt As TextBox
Property Set TextBox(obj As Object)
Set txt=obj
End Property
Private Sub txt_Change()
if not IsNumeric(txt) then txt=""
End Sub'Form1
Dim clstxt1 As New Class1
Private Sub Form_Load()
dim i as long
for i=0 to 1
set clstxt1.TextBox=Me.Text1(i)
next
End Sub
如果你实际运行一下你就会发现你这样是不可能的.
根本无法编译
发生错误.
这类问题,如果使用纯VB处理,我认为只有回调一途
根本无法编译