Hi all,

I have problem in my VB code.
I have a text box in GUI for the user to key in the input which is a number,i need to set condition for the input that the user key in. i have write the code as below,

Private Sub textbox_Change()

If Val(textbox.Text) < 0.03 Then
MsgBox "cannot less than 0.03!", vbCritical
' reset the invalid number
textbox.Text = ""
End If

End Sub



1. The problem is when the user enter a number for example 0.05 which should be valid for my condition, but the msgbox pop up immediately when the user just enter the first number of (0.05) which is 0.
Actually i want the program to verify the number only after the user has finish enter their desire number inside text box.

2. The text box in my condition is just valid for digit number, if the user enter any input other than a number for example " a, b, c..." then the program will pop up the msg box to warn the user. so what code should i use to add this condition and implement together with my existing condition which is "number input should >0.03 "

can anyone help me on this? i would really appreaciate for any help given.
thanks in advance.