Serial Device Question


I am using the sample project of xojo how to read the serial from a device or barcode scanner.

If InStr(Me.LookAhead(Encodings.ASCII), Chr(13) + Chr(10)) > 0 Then OutputArea.Text = OutputArea.Text + Me.ReadAll(Encodings.ASCII) End If

but the result is hard to be calculated, because the code is added an enter key or Chr(13) to separated into three lines.

?kg1 G0000110 L0000000

how to get the result without adding the chr(13)

I want to get the result like,

?kg1?G0000110 ?L0000000

and I want the result in a listbox, not in textarea. because its too hard to select the result while the device is continuously sending the data.

any help ?


Strip out/replace the Chr(13) with something else.

Split the output into columns of your listbox based on the Chr(13) (if you have multiple columns).

or ← this is better for your need

from “ReplaceAll”

Var result As String
Var source As String = "xyxyxy"
result = source.ReplaceAll("x", "z") // returns "zyzyzy"

source = "the quick fox"
result = source.ReplaceAll(" ", "") // returns "Thequickfox"
result = source.ReplaceAll(" ", ", ")  // returns "The, Quick, Fox"