I am making a forms application is Visual C#. I have a textbox where a user must enter a number and a uppercase letter, example “9D”.
What I need to do is put that letter into a byte array as a byte…so in my byte array it would:
array[index] = 0x9D
I know that the textbox class represents the 9D as a string. I am confused on how to make it into a literal byte (9D) and stick it in the array.
New to .Net so any help would be appreciated. I’ve looked at the System.Convert class and don’t see anything I can use.
Use
Byte.Parse(string, NumberStyles):Or
Byte.TryParse(string, NumberStyles, IFormatProvider, out Byte)to more gracefully handle invalid input.