HELP! Plz! Events in a class...
Ok... I created a COM object that simply creates figures for CompanyA... There is a twist. I have (as seen in previous posts) referenced Winsock because in order to get certain information I need to call another server.
Here in lies the problem..
I have one function in the class
Now, I get all of my numbers EXCEPT for the winsock numbers.
because the function is ending before all of the winsock_events are completing...
VB Code:
Public Function GetData() as string
Dim sData as string 'this holds all of the data needed to send back
Set oWinSock = New Winsock
gbDataSent = False
oClient.Close
'This section was way to long but it produces the sData variable
oWinSock.RemoteHost = HOST_IP
oWinSock.RemotePort = HOST_PORT
oWinSock.Connect
sData = sData & gsTCPData 'gstcpdata is a global variable that is set in the winsock_DataArrival() event when it receives a response.
GetData = sData
End Function
The problem is that after the oWinsock.Connect runs the function completes and doesn't wait for teh events to fire.
BUT...
If I put a msgbox immediately after the oWinSock.Connect, the data will return perfectly... but it's impossible for the users to do this...
ne ideas???