Solved

Compile Error: New Winsock

Posted on 2002-07-16
8
244 Views
Last Modified: 2013-11-13
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
Comment
Question by:raymng
  • 4
  • 4
8 Comments
 
LVL 1

Expert Comment

by:bfeddish
ID: 7157833

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
 

Author Comment

by:raymng
ID: 7157842
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
 
LVL 1

Expert Comment

by:bfeddish
ID: 7157849

Is theSock the control name?
0
 

Author Comment

by:raymng
ID: 7158688
No, the Winsock control located in the Main Form is called sckDn.
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 1

Expert Comment

by:bfeddish
ID: 7159555

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
 

Author Comment

by:raymng
ID: 7159596
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
 
LVL 1

Accepted Solution

by:
bfeddish earned 100 total points
ID: 7159663

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
 

Author Comment

by:raymng
ID: 7160240
Thanx very much!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
The viewer will learn how to implement Singleton Design Pattern in Java.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now