Oppure

Loading
18/07/08 22:05
M@d_Hacker
Io uso un codice per convertire i decimali in binario..

Ora te lo posto.. Poi te lo modifiki te..

Dim i As Long, x As Long, bin As String
      Const maxpower = 30
      Const maxlenght = 16
      bin = ""
      x = Val(txtdecimale.Text)
      If x > 2 ^ maxpower Then
         MsgBox "Il numero non deve essere più grande di", vbCritical & Str$(2 ^ maxpower)
         iblbinario.Caption = ""
         Exit Sub
      End If
digit:
      If x < 0 Then bin = bin + "1" Else bin = bin + "0"

      For i = maxpower To 0 Step -1
         If x And (2 ^ i) Then
            bin = bin + "1"
         Else
            bin = bin + "0"
         End If
      Next
      iblbinario.Caption = bin
If txtdecimale.Text = "" Then MsgBox "Inserisci numero", vbCritical
End Sub
aaa
18/07/08 22:28
antometal
ma a lui serve da binario a decimale
aaa
18/07/08 22:47
M@d_Hacker
Postato originariamente da M@d_Hacker:

Io uso un codice per convertire i decimali in binario..

Ora te lo posto.. Poi te lo modifiki te..

aaa
18/07/08 23:03
antometal
la vedo dura procedere a ritroso dal tuo codice per chi nn conosce le conversioni in diverse basi

cmq

Function Dec_da_bin(bin As String) As Integer
Dim Decimale As Integer
    For i = 1 To Len(bin)
        Decimale = Decimale + CInt(Mid(StrReverse(bin), i, 1)) * 2 ^ (i - 1)
    Next i
Dec_da_bin = Decimale
End Function
aaa