17-10-12, 12:33 AM
كاتب الموضوع : AhmedEssawy
كود :
'BaseConv
'R.Stewart
'16/05/2007
'Converts decimal number to base of choice.
'Returns a string.
'UPDATED FROM DecToBin
Private Function BaseConv(intNumber, intBase)
'Specification: Base 2 (Bin), Base 8 (Oct), Base 16 (Hex)
Dim intOffset As Integer
Dim strConv As String
intOffset = 55
Do Until intNumber = 0
If intNumber Mod intBase < 10 Then
strConv = intNumber Mod intBase & strConv
Else
strConv = Chr(intNumber Mod intBase + intOffset) & strConv
End If
intNumber = (intNumber - intNumber Mod intBase) / intBase
Loop
BaseConv = strConv
End Function
Private Sub Form_Load()
MsgBox (BaseConv(13, 2))
End Sub