Solved

Compile Error: New Winsock

Posted on 2002-07-16
8
245 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can use conditional statements using Python.
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 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.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

863 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

27 Experts available now in Live!

Get 1:1 Help Now