Dim MyValue
Dim MyValue1 'Declare Variables
MyValue = Text1.Text 'Text to be analysed source
MyValue = "&H" + MyValue 'Tell vb that this string is a hexadecimal value
On Error GoTo ItsNoHex 'If the value is not valid, tell the user of it
MyValue1 = MyValue + &HFF 'Do a little test
MsgBox "This is a valid hexadecimal value!", , "Checking" 'Tell the user
Exit Sub 'The value is ok. Get out of here :)
ItsNoHex:
If Err = 13 Then 'See if the error is really a hexadecimal error
MsgBox "This is a invalid hexadecimal value!", , "Checking" 'Tell the user
End If
End Sub