Dim UART1 as FormUART = New FormUART
Dim rootNo as integer = 0
Delegate Sub dlgAddText(ByVal GetText As String)
Private Sub Button1_click 〜
Dim Data as String = "ABC"
UART1.Send(Data)
End Sub
Public Sub AddText(ByVal strGetText As String)
Select Case rootNo
Case 1
Dim strTmp As String = ""
Dim strVer_Array() As String = Split(strGetText)
For i As Integer = 0 To strVer_Array.Length - 1
strTmp = strTmp + Chr(strVer_Array(i))
Next
TextBox1.Text = strTmp
Case 2
〜
End Select
End Sub
−−−−−−−−−−−−−−−
Class FormUART
Dim LByte As List(Of Byte) = New List(Of Byte)
Private Sub SerialPort1_DataReceived(ByVal sender As System.Object, _
ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) _
Handles SerialPort1.DataReceived
〜(strInに取り込んだデータを格納)
Me.Invoke(New Form1.dlgAddText(AddressOf Form1.AddText), New Object() {strIn})
End Sub