Sunday, 5 October 2014

Cara merubah bilangan hexadesimal ke binary pada vb6

Hexadecimal to binary
Berikuta adalah codingan atau cara merubah atau convert konversi bilangan hexadecimal ke binary dengan vb6

Function HexToBinary(str As String, Optional Seperator As String = "")

Dim TempStr As String
Dim X As Integer



For X = 1 To Len(str)

    Select Case Mid(str, X, 1)

        Case "0"
            TempStr = TempStr & "0000"
        Case "1"
            TempStr = TempStr & "0001"
        Case "2"
            TempStr = TempStr & "0010"
        Case "3"
            TempStr = TempStr & "0011"
        Case "4"
            TempStr = TempStr & "0100"
        Case "5"
            TempStr = TempStr & "0101"
        Case "6"
            TempStr = TempStr & "0110"
        Case "7"
            TempStr = TempStr & "0111"
        Case "8"
            TempStr = TempStr & "1000"
        Case "9"
            TempStr = TempStr & "1001"
        Case "A"
            TempStr = TempStr & "1010"
        Case "B"
            TempStr = TempStr & "1011"
        Case "C"
            TempStr = TempStr & "1100"
        Case "D"
            TempStr = TempStr & "1101"
        Case "E"
            TempStr = TempStr & "1110"
        Case "F"
            TempStr = TempStr & "1111"
    End Select

    TempStr = TempStr & Seperator

Next

HexToBinary = TempStr
End Function


Private Sub Command1_Click()
Text2.Text = HexToBinary(Text1.Text)

End Sub


Perhatian: Yuk Baca Artikel bagus di Nurul Musthofa

Artikel Terkait

No comments:

Post a Comment

 

Network

Pesan

Semoga situs ini bermanfaat