minusm
Messages postés1Date d'inscriptionmercredi 26 octobre 2005StatutMembreDernière intervention15 mai 2006
-
15 mai 2006 à 20:18
claudelo
Messages postés1Date d'inscriptionjeudi 25 mai 2006StatutMembreDernière intervention30 mai 2006
-
30 mai 2006 à 09:25
Je cherche a savoir s'il y a une fction qui convertis les decimal en
binaire comme celle qui existe pour les decimaux vers les hexas (par
hex(nbr_deci) fct de visual studio.NET ??
C juste pr simplifier un code ki me semble bien trop tiré par les cheveux ....
claudelo
Messages postés1Date d'inscriptionjeudi 25 mai 2006StatutMembreDernière intervention30 mai 2006 30 mai 2006 à 09:25
Public
Function DecToBin(DeciValue AsLong, Optional NoOfBits AsInteger = 8) _
AsString
'********************************************************************************
'* Name : DecToBin
'* Date : 2003
'* Author : Alex Etchells
'*********************************************************************************
Dim i AsInteger
'make sure there are enough bits to contain the number
DoWhile DeciValue > (2 ^ NoOfBits) - 1
NoOfBits = NoOfBits + 8
Loop
DecToBin = vbNullString
'build the string
For i = 0 To (NoOfBits - 1)
DecToBin = CStr((DeciValue And 2 ^ i) / 2 ^ i) & DecToBin
Next i
EndFunction