Hola:
Este codigo te obtiene, el Binario de Caracteres y numeros.......
Function GetCharBinary(ByVal Caracter As Char) As String
Dim valor As Integer = Asc(Caracter)
Dim s As String = ""
While valor > 0
If valor Mod 2 = 0 Then
s = s & "0"
valor = valor / 2
Else
s = s & "1"
valor = Math.Round(((valor / 2) - 0.1))
End If
End While
'con esta sentencia obtienes la cadena al reves
Return Microsoft.VisualBasic.StrReverse(s)
End Function
Function GetNumberBinary(ByVal Valor As Integer) As String
Dim s As String = ""
While valor > 0
If valor Mod 2 = 0 Then
s = s & "0"
valor = valor / 2
Else
s = s & "1"
valor = Math.Round(((valor / 2) - 0.1))
End If
End While
'con esta sentencia obtienes la cadena al reves
Return Microsoft.VisualBasic.StrReverse(s)
End Function
Private Sub cmdShow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdShow.Click
'Binario del caracter 5
MsgBox(GetCharBinary("5")) '110101 Binario
MsgBox(Asc("5")) '53 ----> Ascii
'Binario del numero 5
MsgBox(GetNumberBinary(5)) '101 Binario
End Sub