konfersi bilangan hexa,oktal dan biner dengan VB.Net

hari ne ane  postingkan tentang konfersi bilangan dari hexa,octal dan biner....




VB.net

dibawah ini listhing program konfersi bilangan hexa,oktal dan biner








 Public Class shodiqblogspot
Private Sub biner_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles biner.Click
        Dim xhexa As String = Hex(Val(input.Text))
        Dim xbin As String
        Dim xbin2 As String
        Dim xkata As String
        Dim i As Integer
        xbin2 = ""
        For i = 1 To Len(xhexa)
            xbin = ""
            xkata = Mid(xhexa, i, 1)
            Select Case UCase(xkata)
                Case "0"
                    xbin = "0000"
                Case "1"
                    xbin = "0001"
                Case "2"
                    xbin = "0010"
                Case "3"
                    xbin = "0011"
                Case "4"
                    xbin = "0100"
                Case "5"
                    xbin = "0101"
                Case "6"
                    xbin = "0110"
                Case "7"
                    xbin = "0111"
                Case "8"
                    xbin = "1000"
                Case "9"
                    xbin = "1001"
                Case "A"
                    xbin = "1010"
                Case "B"
                    xbin = "1011"
                Case "C"
                    xbin = "1100"
                Case "D"
                    xbin = "1101"
                Case "E"
                    xbin = "1110"
                Case "F"
                    xbin = "1111"
                Case "h", "H"
                    xbin = ""
            End Select
            xbin2 = xbin2 + xbin
        Next i
        output.Text = xbin2
    End Sub

    Private Sub oktal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles oktal.Click
        output.Text = Oct(Val(input.Text))
    End Sub

    Private Sub hexa_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hexa.Click
        output.Text = Hex(Val(input.Text))
    End Sub
End Class

0 Response to "konfersi bilangan hexa,oktal dan biner dengan VB.Net"

Post a Comment