Page 1 of 1

Command Prefix in C#

Posted: Tue Jan 20, 2004 5:29 pm
by PatO
How do I send a command prefix (and other control chars) in C#? (using the ancient MSCOMM control)
In VB 6.0, this works -

Code: Select all

CP = Chr$(&HFE)
MSComm.Output = CP & "X"
I don't quite understand the theory behind what is being sent.
The MSCOMM control accepts a text string in C#. Not sure what it was in VB. Perhaps the encoding is incorrect... Is it an array? Is it a bit?
I'm so lost it's not even funny.
Please Help!

Posted: Wed Jan 21, 2004 4:53 pm
by PatO
Found it -

Code: Select all

int d = 0xFE;
char d1 = Convert.ToChar(d);
this.axMSComm1.Output = d1 + "X";