by Peter Elisa Souhoka (21 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: VB.NET
Difficulty: Unknown Difficulty
Originally Published: Fri 18th April 2008
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Remote Chat
Dim txtData As String
Private Sub Form_Load()
sckChat.RemoteHost = RemoteForm.sckIdentifier.RemoteHost
sckChat.RemotePort = 1002
sckChat.Connect
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
sckChat.Close
End Sub
Private Sub sckChat_Close()
SendBttn.Enabled = False
Unload Me
End Sub
Private Sub sckChat_Connect()
SendBttn.Enabled = True
End Sub
Private Sub sckChat_DataArrival(ByVal bytesTotal As Long)
Dim getData As String, Position As Long
sckChat.getData getData
getData = sckChat.RemoteHost & " : " & getData & vbCrLf
GetTxt.Text = GetTxt.Text & getData
Position = Len(GetTxt.Text)
GetTxt.SelStart = Position
SendTxt.SetFocus
End Sub
Private Sub Label1_Click()
End Sub
Private Sub SendBttn_Click()
txtData = SendTxt.Text
If txtData <> "" Then
sckChat.SendData txtData
SendTxt.Text = ""
SendTxt.SetFocus
End If
End Sub
Private Sub SendTxt_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Call SendBttn_Click
End If
End Sub