B4J Question What's wrong in this vb6 ---> b4j conversion code?

Beja

Expert
Licensed User
Longtime User
Hi to all,

I have this vb6 code
MSComm1.Output = "AT+CMGD=1,4" & vbCrLf

and the above is converted to:
astream.write "AT+CMGD=1,4" & CrLf

The string must be terminated with CrLf

Note the goal is to send a string to the serial port, regardless of the contents of the string.. so don't worry about the AT
command.. This is a simple string sent to the port, not AT code.

Thanks in advance.
 

udg

Expert
Licensed User
Longtime User
CRLF = Chr(10). This is true for B4J, B4A and B4i.

Edit: searching for "CRLF" I found
https://www.b4x.com/android/forum/threads/crlf-strangeness.58632/#content

Following the posts in the thread you can read Erel's statement above and a few alternatives on how to circumvent "the problem".

I don't know vb6 but googling for vbCRLF I found it is equivalet to chars 13+10 (DOS/Windows style)
 
Last edited:
Upvote 0

Roycefer

Well-Known Member
Licensed User
Longtime User
At a glance, vbCRLF and CRLF aren't the same. The former is Chr(13) & Chr(10) (or maybe the other way around) whereas the latter is just Chr(10).
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
Thanks udg and Roycefer,
From your input I assume the right representation is:

astream.write "AT+CMGD=1,4" & Chr(13) & Chr(10)
 
Upvote 0
Top