blah blah blah is here! blah blah » Close

up0down
link

Hi All,

Probably asked this before but....
I have come across an issue with the Serial Port Class trying to find a method of sending numbers and control charcaters using the BinaryWriter object. I was using:

BinaryWriter bw = new BinaryWriter(textBox13.Text); 

textBox13.Text = "1590"+"\n";

and outputting it via a com port as below
AutoLoadComPort.Write(bw);

Now before I carried away modding code
AutoLoadComPort.Write(bw);

Does that look any wher near possible???

Glenn

last answered one year ago

2 answers

link

I don't see how you can use BinaryWriter with the SerialPort class to send a string and, even if you could, it wouldn't be a good idea as the string would be automatically length prefixed.

Why not just do:

textBox13.Text = "1590"+"\n";
serialPort1.Write(textBox13.Text);

up0down
link

Sorry some confusion here, I'm not trying to send strings, I'm trying to send int's & control codes, could you see question asked 2nd August.

Glenn

Which I think has answered the question

Feedback