7050Views5Replies

Author Options:

what is vbCr in vb 2010 ? And, must we add vbCr to send a string to serialport ? Answered

i want to send and receive at command to my phone using vb

Discussions

The forums are retiring in 2021 and are now closed for new topics and comments.
0
g-one
g-one

Best Answer 10 years ago

I only can give you the answer to your first question. vbCr is a VB constant that contains the Carriage Return character ( same like Chr(13) ). Carriage Return lets jump the cursor to the beginning of the current line. A normal line breake in Windows needs a Carriage Return followed by a Line Feed Chr(10) . VB knows the constant vbCrLf to generate both characters.

But I have really no idea if you would need a vbCr to separate data for your command or what ever ...

0
Rendydevara
Rendydevara

Answer 10 years ago

Thank you

so, i got this code from a website
.............................
.............................
SerialPort1.WriteLine(data & vbCr)
.............................
.............................

for what is vbCr in serial port ?

0
g-one
g-one

Answer 10 years ago

This construct makes no sense to me. WriteLine appends CR and LF automatically to your string in "data". No idea what an additional CR could be good for.

0
Rendydevara
Rendydevara

Answer 10 years ago

Thank you
i understand now

but how to add a Carriage Return in C# ?

0
g-one
g-one

Answer 10 years ago

I'm not familar with C# but as far as I remember it should be "\r" for Carriage Return and "\n" for Line Feed.