Sample code for converting number systems

Here is a working sample code for converting decimal number system to hexadecimal number system and vice versa.

Private Sub cmdConvert_Click()
Dim decNumber As Double
Dim hexNumber As String
If Text1.Text <> “” Then
decNumber = Val(Text1.Text)
hexNumber = Hex(decNumber)
Text2.Text = hexNumber
Else
hexNumber = Text2.Text
decNumber = CInt(“&H” & hexNumber)
Text1.Text = decNumber

End If

End Sub

The interface is as follows: