Cara Merubah hexadecimal to string pada vb6

 Berikut adalah cara merubah atau mengkonversi hexadecimal to string pada vb6

Public Function HexToStr(ByVal Data As String) As String
    Dim Buffer As String
    
        If Len(Data) Mod 2 <> 0 Then
            HexToStr = vbNullString
        Else
            For i = 1 To Len(Data) - 1 Step 2
                Buffer = Buffer & Chr("&H" & Mid(Data, i, 2))
            Next i
            HexToStr = Buffer
        End If
    End Function

atau kaya gini

Private Function HexToStr2(s As String) As String
Dim i As Integer
Dim dbl As Double
Dim iLen As Integer
Dim strReturn As String
Dim strHex As String

strReturn = ""
iLen = Len(s)
For i = 1 To iLen Step 2
dbl = Val("&H" & Mid(s, i, 2))
strHex = Chr(CLng(dbl))
strReturn = strReturn + strHex
Next i
HexToStr2 = strReturn
End Function


ngegunain fungsi nya
Text1.Text = HexToStr(Text2.Text)
Text1.Text = HexToStr2(Text2.Text)


download project nya di mari:
http://www.4shared.com/rar/uFpZQyP-ce/hexatostring.html

0 Komentar:

Posting Komentar