Hello,
I've got the below code. What I'm trying to do is get the values entered by the user into textbox4 and place them into a byte array.
Code:
private void button1_Click(object sender, EventArgs e)
{
Byte[] OUTBuffer = new byte[65];
int decValue = Convert.ToInt16(textBox4.Text);
OUTBuffer[0] = 0;
OUTBuffer[1] = 0x80;
byte[] intBytes = BitConverter.GetBytes(decValue);
Array.Copy(intBytes, 0, OUTBuffer, 2, intBytes.Length);
Console.WriteLine(OUTBuffer[2] + OUTBuffer[3]);
}
But it's not working right. Once I go over the value of 255 into the text box I do not get the correct value displayed in the console when i try adding OUTBuffer[2] + OUTBuffer[3].
Any help here will be appreciated.