Mar 23

Convert Hexadecimal to ASCII

Visual Basic 6 function that will convert the Hexadecimal value into ASCII value. Please copy the code below to module area and call the function name hexToascii like sample below.

 

 

 

 

 

 

Visual Basic Code

Command1_Click()
Text1.Text = hexToascii(Text2.Text)
End Sub

For x = 1 To Len(hextext)
num = Mid(hextext, x, 2)
Value = Value & Chr(Val("&h" & num))
x = x + 1 Next x
hexToascii = Value
End Function
Apr 15

How to use Message Box

‘This tutorial pop-up a message to user to confirm. Here’s the code

Private Sub Command1_Click()
Dim myValue As String
myValue = MsgBox(“Are your sure you want to delete this file?”, vbQuestion + vbYesNo, “Confirm Delete”)
If myValue = vbNo Then Exit Sub ‘ Do nothing
‘—- Do some codes here to delete record in database

End Sub

Parameters

Prompt
Required. String expression displayed as the message in the dialog box. The maximum length of Prompt is approximately 1024 characters, depending on the width of the characters used. If Prompt consists of more than one line, you can separate the lines using a carriage return character (Chr(13)), a line feed character (Chr(10)), or a carriage return/linefeed character combination (Chr(13)Chr(10)) between each line.

Buttons
Optional. Numeric expression that is the sum of values specifying the number and type of buttons to display, the icon style to use, the identity of the default button, and the modality of the message box. If you omit Buttons, the default value is zero.

Title
Optional. String expression displayed in the title bar of the dialog box. If you omit Title, the application name is placed in the title bar.