well i went ahead and atempted to make this chat program-,
I ran into to problems:
the textbox wouldn't go down to the next line
the connecting client would freeze
here is my code:
Private Sub cmdsend_Click()
If txtsend.Text <> "" Then
ws.SendData ("ch" + txtname.Text + ": " + txtsend.Text)
txtcon.Text = txtcon.Text & vbCrLf & txtname.Text + ": " + txtsend.Text
txtsend.Text = ""
txtsend.SetFocus
End If
End Sub
Private Sub Form_Load()
Dim Received As String
Dim Data As String
If ws.LocalIP = "127.0.0.1" Then
MsgBox "NOTE: You are not connected to the internet", vbCritical, "ERROR- NO CONNECTION"
End If
Label3.Caption = "Your IP Address is: " + ws.LocalIP
End Sub
Private Sub ws_ConnectionRequest(ByVal requestID As Long)
ws.Close
ws.Accept requestID
txtcon.Text = txtcon.Text & vbCrLf & "----- Connection Established -----"
cmdsend.Enabled = True
txtname.Enabled = False
txtsend.SetFocus
End Sub
Private Sub ws_DataArrival(ByVal bytesTotal As Long)
ws.GetData Received
Select Case Left$(Received, 2)
Case "ch"
Data = Right$(Received, Len(Received) - 2) & vbCrLf
txtcon.Text = txtcon.Text & vbCrLf & Data
End Select
End Sub
Private Sub ws_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
If Number <> 0 Then
txtcon.Text = txtcon.Text & vbCrLf & "----- Error [" & Description & "] -----"
Call cmdclose_Click
End If
End Sub
I do no see what is wrong
I ran into to problems:
the textbox wouldn't go down to the next line
the connecting client would freeze
here is my code:
Private Sub cmdsend_Click()
If txtsend.Text <> "" Then
ws.SendData ("ch" + txtname.Text + ": " + txtsend.Text)
txtcon.Text = txtcon.Text & vbCrLf & txtname.Text + ": " + txtsend.Text
txtsend.Text = ""
txtsend.SetFocus
End If
End Sub
Private Sub Form_Load()
Dim Received As String
Dim Data As String
If ws.LocalIP = "127.0.0.1" Then
MsgBox "NOTE: You are not connected to the internet", vbCritical, "ERROR- NO CONNECTION"
End If
Label3.Caption = "Your IP Address is: " + ws.LocalIP
End Sub
Private Sub ws_ConnectionRequest(ByVal requestID As Long)
ws.Close
ws.Accept requestID
txtcon.Text = txtcon.Text & vbCrLf & "----- Connection Established -----"
cmdsend.Enabled = True
txtname.Enabled = False
txtsend.SetFocus
End Sub
Private Sub ws_DataArrival(ByVal bytesTotal As Long)
ws.GetData Received
Select Case Left$(Received, 2)
Case "ch"
Data = Right$(Received, Len(Received) - 2) & vbCrLf
txtcon.Text = txtcon.Text & vbCrLf & Data
End Select
End Sub
Private Sub ws_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
If Number <> 0 Then
txtcon.Text = txtcon.Text & vbCrLf & "----- Error [" & Description & "] -----"
Call cmdclose_Click
End If
End Sub
I do no see what is wrong