我在类模块中使用winsock的connect就出现了错误
定义
Private WithEvents Send_Http As Winsock
出错的地方
Send_Http.Connect "127.0.0.1", 80怎么回事呢?!

解决方案 »

  1.   

    Private WithEvents s As TimerPrivate Sub Class_Initialize()
    s.Interval = 100
    s.Enabled = True
    End SubPrivate Sub s_Timer()
    Debug.Print Now
    End Sub
    这样也会出现错误,是不是类模块中不能使用其他组件哦?!
      

  2.   

    上面的是class1中的下面的代码是form1中的
    Dim n As Class1Private Sub Form_Load()
    Set n = New Class1
    End Sub
      

  3.   

    当然出错了,timer控件没有实例化,可以用settime函数代替timer控件
      

  4.   

    在类模块当中这样子定义s不会自动实例化.由于ActiveX控件的特殊性,不方便这样子使用.建议使用Active Object代替或者最好使用API.