6483Views5Replies

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

5 Replies

user
g-oneBest Answer (author)2010-10-11

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 ...

Select as Best AnswerUndo Best Answer

user
Rendydevara (author)g-one2010-10-12

Thank you

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

for what is vbCr in serial port ?

Select as Best AnswerUndo Best Answer

user
g-one (author)Rendydevara2010-10-12

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.

Select as Best AnswerUndo Best Answer

user
Rendydevara (author)g-one2010-10-13

Thank you
i understand now

but how to add a Carriage Return in C# ?

Select as Best AnswerUndo Best Answer

user
g-one (author)Rendydevara2010-10-13

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

Select as Best AnswerUndo Best Answer