how can I read 4 hex characters from a textbox and put them in a uint?
-
I need to read 4 hexadecimal chars from a textbox and put them into a Uint how can I do that? BiG RaLpH
-
I need to read 4 hexadecimal chars from a textbox and put them into a Uint how can I do that? BiG RaLpH
-
I need to see if I can change the hex 2. ie: textbox2.text = "1212abab" the uint returned must be 1212 and another abab. BiG RaLpH
Hi, you could: 1. use long.TryParse() and then split the long in upper and lower halfs. 2. split the string in two parts, and use int.TryParse() on each of them. The second method may be more difficult since it may have to cope with varying string lengths when leading zeroes are omitted in the string. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google
-
I need to read 4 hexadecimal chars from a textbox and put them into a Uint how can I do that? BiG RaLpH
You can use
uint num = Convert.ToUInt16(textBox1.Text, 16);
If the textbox contains more than 4 letters and if you want to change each 4 letters in to their uint value, you should first write a text splitter which is very simple withstring.substring()
function. Best Regards Zafer