Solved

Compile Error: New Winsock

Posted on 2002-07-16
8
246 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:Raymond
  • 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:Raymond
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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

Author Comment

by:Raymond
ID: 7158688
No, the Winsock control located in the Main Form is called sckDn.
0
 
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:Raymond
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:Raymond
ID: 7160240
Thanx very much!
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to debug this code 7 61
to transfer string from C lanaguage to VBA 4 66
What language/protocol is the Angular Chat? 2 77
How to read File Date Created using VB6 8 39
Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

809 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