تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
تحويل الرقم العشري الي Bin- Oct- Hex
#1
كاتب الموضوع : 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
}}}
تم الشكر بواسطة:



التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم