• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 254
  • Last Modified:

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
0
Raymond
Asked:
Raymond
  • 4
  • 4
1 Solution
 
bfeddishCommented:

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.
0
 
RaymondAuthor Commented:
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
0
 
bfeddishCommented:

Is theSock the control name?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
RaymondAuthor Commented:
No, the Winsock control located in the Main Form is called sckDn.
0
 
bfeddishCommented:

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.
0
 
RaymondAuthor Commented:
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
0
 
bfeddishCommented:

Sounds like you want to use a library instead of a control but why don't you just pass the class a pointer to a winsock control that's on your form?
0
 
RaymondAuthor Commented:
Thanx very much!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now