#类模块class1.cls的代码如下:Public i As IntegerPublic Function fun()
MsgBox "hello"
End Function#Form1的代码如下:Public c As New Class1Private Sub Form_Load()
Set c = Null '为什么不能置null?
End Sub运行时报错:实时错误‘424’ 要求对象我的问题是,为什么class1类型的c不能用null赋值?
为什么我的一本参考书上却是类似这样写了?
MsgBox "hello"
End Function#Form1的代码如下:Public c As New Class1Private Sub Form_Load()
Set c = Null '为什么不能置null?
End Sub运行时报错:实时错误‘424’ 要求对象我的问题是,为什么class1类型的c不能用null赋值?
为什么我的一本参考书上却是类似这样写了?
set c = Nothing
If c Is Nothing Then
MsgBox "nothing"
Else
MsgBox "not nothing"
End If
If c = Nothing Then
试一试不就知道了。
If c = Nothing Then我试了两个都不行啊
我写Public c As New Class1的时候多了个new
散分
谢谢大家