5
Contributors
4
Replies
21
Views
4 Years
Discussion Span
Last Post by tinstaafl
0

its simple
use the following code on textbox lostfocus event

If Val(Text1.Text) > 100 Then
MsgBox "Invalid "
Text1.SetFocus
End If
0

Hi,

In Property pages of Text1 .. MaxLength = 3
write this code, in Validate Event of textbox

Private Sub Text1_Validate(Cancel As Boolean)
    If Val(Text1.Text) > 0 And Val(Text1.Text) <=100 Then
    Else
        Cancel = True
    End If
End Sub

Regards
Veena

0

If you just want the number entered...use a NumericUpDown control, it will allow you to set a valid range of values

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.