Click here to Skip to main content
15,894,539 members

Comments by Henri Aghaei (Top 6 by date)

Henri Aghaei 9-Jun-17 12:27pm View    
Many thanks! I will wrestle it down!
Henri Aghaei 9-Jun-17 12:14pm View    
No. Don't do that please! LOL

I was intending to make the same format for the read buffer, but the problem is that

textBox2.Text = strHEX

is not acceptable and I need to find a way to put my hex array into the box!


Comes up with the following error.

Error 1 Cannot implicitly convert type 'System.Text.StringBuilder' to 'string'
Henri Aghaei 9-Jun-17 11:30am View    
S Houghtelin,

I am not too sure if I've got what you just explained.

Here is my code as follows.

byte[] bytesToSend = new byte[14] { 0x68,0x99,0x99,0x99,0x99,0x99,0x99,0x68,0x23,0x02,0x61,0x00,0xEC,0x16 };


serialport1.Write(bytesToSend, 0, 14);

System.Threading.Thread.Sleep(200); // wait for .5 sec




textBox2.Text = serialport1.ReadExisting();


But what you said by Format is not clear to me. What should I add to my read buffer to see Hex coming in?
Henri Aghaei 9-Jun-17 11:09am View    
Thanks for your prompt reply. Well actually I am reading from the port and I receive text instead of hex. I used: textBox2.Text = serialport1.ReadExisting();
That's why I am asking how I can read back in HEX. Any advice on this please?
Henri Aghaei 9-Jun-17 10:21am View    
in VS2013 C# forms there is no "HEX" syntax. What would you suggest then?