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





Reply With Quote