Salve a tutti qualche giorno fa, seguendo la logica che si usa per convertire con carta e penna, ho fatto un convertitore da binario a decimale in VB...
Screen:
Codice Sorgente:
codice:
Public Class Form1
Dim bits128, bits64, bits32, bits16, bits8, bits4, bits2, bits1 As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
bits128 = TextBox1.Text
bits64 = TextBox2.Text
bits32 = TextBox3.Text
bits16 = TextBox4.Text
bits8 = TextBox5.Text
bits4 = TextBox6.Text
bits2 = TextBox7.Text
bits1 = TextBox8.Text
TextBox9.Text = 0
If Val(bits128) = 1 Then
TextBox9.Text = Val(TextBox9.Text) + 128
End If
If Val(bits64) = 1 Then
TextBox9.Text = Val(TextBox9.Text) + 64
End If
If Val(bits32) = 1 Then
TextBox9.Text = Val(TextBox9.Text) + 32
End If
If Val(bits16) = 1 Then
TextBox9.Text = Val(TextBox9.Text) + 16
End If
If Val(bits8) = 1 Then
TextBox9.Text = Val(TextBox9.Text) + 8
End If
If Val(bits4) = 1 Then
TextBox9.Text = Val(TextBox9.Text) + 4
End If
If Val(bits2) = 1 Then
TextBox9.Text = Val(TextBox9.Text) + 2
End If
If Val(bits1) = 1 Then
TextBox9.Text = Val(TextBox9.Text) + 1
End If
End Sub
Download: http://www.evilshare.com/d89f9d12-d7...9-00a0c993e9d6
Ovviamente con carta e penna so convertire anche da decimale a binario...ma non riesco a capire come potrei fare anke questo in VB...potreste darmi qualke aiuto?
E anche per convertire in esadecimale...GRAZIE !!