|
-
Apr 28th, 2005, 05:29 AM
#1
Thread Starter
New Member
How to trap connect error? [Resolved]
Hi,
I have a problem with winsock.
If I accidentially or intentionally click on the connect button more then once, I had the following error.
Run-time error '40020';
Invalid operation at current state
Question:
How can I trap or eliminate the problem of clicking on connect more then once?
I had tried the following code and doesn't seems to work as expected.
VB Code:
Private Sub cmdConnect_Click()
If tcp.State = sckConnecting Then
tcp.Close
Exit Sub
End If
tcp.Connect ServerIP, Port
End Sub
Last edited by igmeou; Apr 28th, 2005 at 06:14 AM.
Will the laziest programmers produced you the easliest way to code? 
-
Apr 28th, 2005, 06:14 AM
#2
Thread Starter
New Member
Re: How to trap connect error?
Ok NVM. I found out that I should close the connection before connecting thats all...
VB Code:
Private Sub cmdConnect_Click()
tcp.Close
tcp.Connect ServerIP, chatPort
End Sub
Will the laziest programmers produced you the easliest way to code? 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|