#类模块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赋值?
为什么我的一本参考书上却是类似这样写了?

解决方案 »

  1.   

    尽信书不如无书。
    set c = Nothing
      

  2.   

    我加个判断,但是结果为什么会是not nothing?我该怎样判断c呢?
        If c Is Nothing Then
            MsgBox "nothing"
        Else
            MsgBox "not nothing"
        End If
      

  3.   

    If c Is Nothing Then
    If c = Nothing Then
    试一试不就知道了。
      

  4.   

    If c Is Nothing Then
    If c = Nothing Then我试了两个都不行啊
      

  5.   

    不是isnull
    我写Public c As New Class1的时候多了个new
    散分
    谢谢大家