Convert from decimal to hexidecimal?
-
Since everything is represented internally in Binary, the only "hexadecimal conversion" you're going to get would be when it's formatted into a string for display or some other human-readable purpose. That would be
String.Format("{0:X}", value)
.A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008
But no longer in 2009... -
In VB.Net...
dim string hex = Convert.ToString(i, 16);
Or in VB6... use a textbox and three labels:Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
Label1.Caption = Hex$(Text1.Text)
If Len(Label1.Caption) < 4 Then
Label2.Caption = "00"
Label3.Caption = Label1.Caption
Else
Label2.Caption = Left$(Label1.Caption, 2)
Label3.Caption = Right$(Label1.Caption, 2)
End If
End If
End SubRun the program, type any integer legal number value and press ENTER.
------------------------------------ I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
modified on Friday, April 30, 2010 10:27 AM
-
In VB.Net...
dim string hex = Convert.ToString(i, 16);
Or in VB6... use a textbox and three labels:Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
Label1.Caption = Hex$(Text1.Text)
If Len(Label1.Caption) < 4 Then
Label2.Caption = "00"
Label3.Caption = Label1.Caption
Else
Label2.Caption = Left$(Label1.Caption, 2)
Label3.Caption = Right$(Label1.Caption, 2)
End If
End If
End SubRun the program, type any integer legal number value and press ENTER.
------------------------------------ I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
modified on Friday, April 30, 2010 10:27 AM
-
Shhh!
------------------------------------ I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
-
Shhh!
------------------------------------ I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave