Reading Text As Hexadecimal Value?

The Dharmatist

New member
Joined
Jan 7, 2008
Messages
1
Programming Experience
3-5
I am writing an application in which I want to enter a hexadecimal value and perform various operations on it. I can convert to/from hex no problem, once I have a variable, but I can not figure out how to read the initial value entered into the text box as hexadecimal instead of decimal. What do I need to do to accomplish this? I'd rather not have to manually convert the value to decimal every time prior to entering it.
 
VB.NET:
Dim i As Integer
If Integer.TryParse(TextBox1.Text, Globalization.NumberStyles.HexNumber, Nothing, i) Then
    i += 1
    TextBox1.Text = i.ToString("X2")
Else
    TextBox1.Text = String.Empty
End If
 
Back
Top