How can a decimal input be converted to Hex, Octal,Binary or any Base.
I can do this in VB6 but can't seen to in BASIC4PPC. Problem lies in
trying to use the String Mid Function as given below.
Sub btnCalc_Click
Dim HexString
Dim DecValue
HexString = ""
DecValue = txtInput.Text
Do While DecValue > 0
'Get least significant character
HexString = mid("0123456789ABCDEF",Mod(DecValue,16 )+ 1,1) + HexString
'Remove least significant character
DecValue = Int(DecValue/16)
Loop
If len(HexString) < 2 Then
Decimal2Hex = "&H" + Right("00" + HexString,2)
Else
Decimal2Hex = "&H" + HexString
End If
txtOutput.Text = Decimal2Hex
End Sub
Any Help will be appreciated
I can do this in VB6 but can't seen to in BASIC4PPC. Problem lies in
trying to use the String Mid Function as given below.
Sub btnCalc_Click
Dim HexString
Dim DecValue
HexString = ""
DecValue = txtInput.Text
Do While DecValue > 0
'Get least significant character
HexString = mid("0123456789ABCDEF",Mod(DecValue,16 )+ 1,1) + HexString
'Remove least significant character
DecValue = Int(DecValue/16)
Loop
If len(HexString) < 2 Then
Decimal2Hex = "&H" + Right("00" + HexString,2)
Else
Decimal2Hex = "&H" + HexString
End If
txtOutput.Text = Decimal2Hex
End Sub
Any Help will be appreciated