Here is the code i've come up with so far for this but it throws this exception when I input a letter value such as AA.
"An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll Additional information: Input string was not in a correct format."
Also I would like to include some error message if the user inputs an invalid value. Any help would be great, thanks.
private void GPIO_Click(object sender, EventArgs e)
{
string hex = WriteValue.Text;
string[] hex1 = hex.Split(',');
byte[] bytes = new byte[hex1.Length];
for (int i = 0; i < hex1.Length; i++)
{
bytes[i] = Convert.ToByte(hex1[i]);
}
for (int i = 0; i < hex1.Length; i++)
{
GPIO(h[index], dir, bytes[i]);
ReadValue.Text += bytes[i].ToString();
}
}