Thread: Question Decimal to hex conversion
View Single Post
  #2 (permalink)  
Old 07-09-2009, 3:08 PM
Solitaire Solitaire is offline
VB.NET Forum Genius
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Jun 2004
Posts: 226
Reputation: 105
Solitaire probably authored a book by nowSolitaire probably authored a book by now
Default Decimal to Hexadecimal

The Hex value is actually a string. You need to convert the decimal string from the textbox into a number and convert it back to a string with the option to display it as a Hex value. Here is the code:


Code:
		Dim num As Integer
		Integer.TryParse(TextBox1.Text, num)
		TextBox2.Text = Convert.ToString(num, 16).ToUpper

Note: You can convert to binary or octal just as easily by replacing the 16 with a 2 or an 8.
Reply With Quote