VB Tutorial - TIBBO Technology
VB Tutorial - TIBBO Technology
VB Tutorial - TIBBO Technology
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Case 8: LblState.Caption = "Peer closing"<br />
Case Else: LblState.Caption = "Error"<br />
End Select<br />
20<br />
'set the caption of the "Connect" button<br />
If WinSock.State = 0 Then<br />
CmdConnect.Caption = "Connect"<br />
Else<br />
CmdConnect.Caption = "Disconnect"<br />
End If<br />
'enable or disable the "Send" button<br />
If WinSock.State = 7 Then<br />
CmdSend.Enabled = True<br />
Else<br />
CmdSend.Enabled = False<br />
End If<br />
End Sub<br />
• Add the code below to the Click event of the CmdConnect button. This code selects open the<br />
connection when it is closed and to close the connection when it is not closed:<br />
Private Sub CmdConnect_Click()<br />
If WinSock.State = 0 Then<br />
WinSock.Connect<br />
Else<br />
WinSock.Close<br />
End If<br />
End Sub