|
-
Aug 25th, 2014, 06:06 AM
#1
Thread Starter
Junior Member
Help with some Beginner Code? - Small problem with entering text.
Hey VBForums. Hoping you guys can help me out with solving a small problem I have.
Code:
Private Sub GuessTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GuessTextBox.TextChanged
If Not IsNumeric(GuessTextBox.Text) Then
GuessTextBox.Text = ""
MsgBox("Hey! Letters don't count. Only numbers")
End If
If IsNumeric(GuessTextBox.Text) > 1000 Then
GuessTextBox.Text = "1000"
End If
End Sub
I have this here, i'm making a simple 'Guess the Number' Kid's game.
If the user enters a non Integer number in the 'GuessTextBox' it will give them that message and erase the number in the box.
Every time the space becomes blank however the message prompts.
So if I type 125 then backspace it, it will give the message. How do I make it so this message only prompts when something non-numeric is placed in?
OR Is there a way I can make it so it simply doesn't allow anything but 1,2,3,4,5,6,7,8,9,0 in the box?
Thanks.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|