class 里面不能引用控件吗?

来源:百度知道 编辑:UC知道 时间:2024/06/08 08:51:01
类模块里面居然不能引用控件名..有什么办法?

Function tianjia( a as form,b as text)

End Function
绝对编译不过,不知道为什么?

可以啊....
窗体,一个按钮,一个text1

窗体代码:
Option Explicit

Private Sub Command1_Click()
Dim c As New Class1
c.tianjia Me, Text1
End Sub

建个类模块,名字class1,代码如下
Option Explicit

Public Function tianjia(a As Form, b As TextBox)
a.Print "不行吗?"
b.Text = "应该可以吧"
End Function