Is a response to a string but not tested listbox sent don't show any information
Don't know where the problem is,,
Private Sub SetText (ByVal [text] As String)
If the Me. The ListBox1. InvokeRequired Then
Dim d As New ContextCallback (AddressOf SetText)
Me. Invoke (d, the New Object () {} [text])
The Else
Me. The ListBox1. Items. The Add ([text])
End the If
End Sub
Private Sub Form1_Disposed (ByVal sender As Object, ByVal e the As System. EventArgs) Handles Me. Disposed
If tcpConnect Then
SwWriter. WriteLine (" STOP ")
SwWriter. Flush ()
NsStream. Close ()
SwWriter. Close ()
End the If
If thThreadRead. IsAlive Then
ThThreadRead. Abort ()
End the If
If Disposing Then
If Not (components Is Nothing) Then
Components. The Dispose ()
End the If
End the If
MyBase. The Dispose (Disposing)
End Sub
Sub the Receive ()
While thThreadRead. IsAlive
Dim sMessage As String=srRead. Read ()
ListBox1. Items. The Add (sMessage)
End While
End Sub
For the first time contact with VB for great god answer ~
And I want to use two button press the button to the MCU send 1 and 2 to select the workings of a single-chip microcomputer
But according to the error is
Private Sub Button4_Click (ByVal sender As System. Object, ByVal e the As System. EventArgs) Handles Button4. Click
Dim sendd As Byte
Sendd=1
TcpClient. Client. Send (" 1 ") 'Send instruction 1
End Sub
Thank ~ hope someone to help me
CodePudding user response:
No one,,Ask Daniel for help
CodePudding user response:
Are you sure that you receive the information? Try:ListBox1. Items. Add (" the Message: "& amp; SMessage)
CodePudding user response: