Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Winsock in a Visual Basic module

Status
Not open for further replies.

multiplex77

Programmer
Dec 25, 2001
302
SG

Is there a way to use the Winsock object in a Visual Basic MODULE or CLASS MODULE instead of only in the Form?

I'm trying to send email using my form, but don't want to place all the Winsock code in the form, but want to place the messy stuff inside a Module and just call it from the form.

Thanks in advance for the help!

Cal
 
You can put the code for the winsock into a function that resides in a module. You will have to pass the winsock instant to that function tho. Hope that helps.
 
Thanks venom3249 ...

I managed to pass it into a module, but it can't invoke the DoEvents method from within the module.

My DoEvents method is supposed to monitor the response from the Winsock object by calling the Procedure:

Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Winsock1.GetData Response ' Check for incoming response
' from Mail Server
End Sub

...but somehow it never invokes this function. I've already passed the whole Winsock object into the module and everything else works except this. Am I missing something?

THanks again...


 
You need to build a control (an OCX) with a single winsock control on it, instead of a module.

Chaz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top