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:
  1. Public Function GetData() as string
  2.  
  3.     Dim sData as string 'this holds all of the data needed to send back
  4.  
  5.     Set oWinSock = New Winsock
  6.     gbDataSent = False
  7.     oClient.Close
  8.  
  9.     'This section was way to long but it produces the sData variable
  10.  
  11.     oWinSock.RemoteHost = HOST_IP
  12.     oWinSock.RemotePort = HOST_PORT
  13.     oWinSock.Connect
  14.  
  15.     sData = sData & gsTCPData 'gstcpdata is a global variable that is set in the winsock_DataArrival() event when it receives a response.
  16.  
  17.     GetData = sData
  18. 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???