منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب
تحويل الرقم العشري الي Bin- Oct- Hex - نسخة قابلة للطباعة

+- منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب (http://vb4arb.com/vb)
+-- قسم : الأقسام التعليمية - المنتدى القديم (http://vb4arb.com/vb/forumdisplay.php?fid=90)
+--- قسم : مكتبة أكواد المنتدى (http://vb4arb.com/vb/forumdisplay.php?fid=111)
+---- قسم : مكتبة أكواد الفيجوال بيسك 6 (http://vb4arb.com/vb/forumdisplay.php?fid=116)
+---- الموضوع : تحويل الرقم العشري الي Bin- Oct- Hex (/showthread.php?tid=5835)



تحويل الرقم العشري الي Bin- Oct- Hex - RaggiTech - 17-10-12

كاتب الموضوع : 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