15,881,938 members
See more:
Hello! I have a trouble. I have a textbox with data as string like "E4". How to convert this textbox.text data to a equal hex number E4? "E4" to &HE4
Posted
Updated 6-Apr-13 7:03am
v2
Zoltán Zörgő 6-Apr-13 13:10pm
What about appending "&H" at the beginning?
Roman Gaisin 6-Apr-13 13:16pm
No matter, I only have a string 4E and have to convert it into a HEX number 4E

## Solution 1

You would absolutely be amazed to find this:
http://msdn.microsoft.com/en-us/library/bb311038.aspx[^]

Pleas read the documentation before posting a question. :)

## Solution 2

Hexadecimal, octal, decimal, binary: they are only representations of the same number. There is no hex number 4E, there is only the value 78. You can parse the hexadecimal representation to get this value, and thank back again to your desired format - but do you really need this?
Check following code lines one by one:
C#
```var input = "4E";
var x = Convert.ToInt32(input, 16);
Console.WriteLine(String.Format("&H{0:X}",x));
Console.WriteLine(String.Format("&H{0}",input));```