I am doing a serial communication project and would like to have the received string go into a text box based on which button was clicked to send the initial string and invoke a response.
The code for the ReceivedText is:
PrivateSub ReceivedText(ByVal [text] As String)
Button1.Clear()
Button2.Clear()
If Button1.InvokeRequired Then
RichTextBox1.text = [text].Trim("!")
End If
If Button2.InvokeRequired Then
RichTextBox2.Text = [text].Trim("!")
End If
EndSub
This just results in the received string going into both of the boxes instead of one or the other.
Is there any way to get the text to go in the appropriate box?