Link to home
Start Free TrialLog in
Avatar of Raymond
RaymondFlag for Hong Kong

asked on

Compile Error: New Winsock

Compile error:

Private Sub Class_Initialize()
   Set theSock = New Winsock   <------error
End Sub

"Compile error: Invaild use of New keyword"

I have another Form that has another Winsock control, do you think this caused the problem? How can I fix this?
Thank You!


raymng
Avatar of bfeddish
bfeddish
Flag of United States of America image


Are you sure you are using the New keyword to instatiate the winsock in your working application?  If you are using the built in control there is no need to instantiate it.
Avatar of Raymond

ASKER

bfeddish,

Class Module:
---------------------------------
Private Sub Class_Initialize()
  Set theSock = New Winsock   <------error
End Sub

Main Form:
---------------------------------
I have placed another Winsock control on the main form.


raymng

Is theSock the control name?
Avatar of Raymond

ASKER

No, the Winsock control located in the Main Form is called sckDn.

If I'm not mistaken, you can just start using the control referenced by it's name. For example sckDn.Connect(), etc. I don't think you need to instantiate another reference to it.
Avatar of Raymond

ASKER

bfeddish:

I need two different Winsock, sckDn is on the Main Form whereas theSock is on the class module. I can use sckDn without problem, but theSock has problem.

Class Module:
---------------------------------
Private Sub Class_Initialize()
 Set theSock = New Winsock   <------error
End Sub


raymng
ASKER CERTIFIED SOLUTION
Avatar of bfeddish
bfeddish
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Raymond

ASKER

Thanx very much!