I tried another method:
Sub button_Click
d.SetPort("/dev/ttyMT2",9600,0x2)
x.Initialize(d.InputStream,d.OutputStream,"astreams")
End Sub
Sub astreams_NewData (Buffer() As Byte)
Dim msg As String
msg = BytesToString(Buffer, 0, Buffer.Length, "UTF8")
edittext2.Text = msg
edittext2.Text = edittext2.text.Replace("�","")
edittext2.Text = edittext2.text.Replace(",","")
End Sub
now, when I press software button, i receive text like this: ��, 123456789
I tried to put timer to tick every second to receive data from barcode scanner, but it is not good. Sometimes I receive ��,��,123456789
��,123456789
123456789
is it possible to use AsyncStreamText class to receive data synchronized ?
like this example: ��, 123456789
��, 123456789
��, 123456789