Home > Software engineering >  Why can't a listbox display information single-chip sent via wifi module
Why can't a listbox display information single-chip sent via wifi module

Time:10-02

I do is a PC program takes microcontroller through the wifi module information transmission to come over and show
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:

refer to the second floor of123 response:
are you sure that you received the information? Try:

ListBox1. Items. Add (" the Message: "& amp; SMessage)


To receive show as ASCII don't know how to convert more than just a message with you this words,,
The buttons and I don't know why a according to the error,,
  • Related