473,378 Members | 1,364 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Validate Textbox input

How do i validate text box entry, in VB. net

In the event that user does not make a text entry, simply pop-up a warning,

thanks

rodger

Nov 22 '05 #1
6 8448
"rodger" <pa*@myisland.spam> wrote...
How do i validate text box entry, in VB. net
In the event that user does not make a text entry, simply pop-up a

warning,

Rodger,

It's a little tricky. You can validate text in the textbox in a couple of
events but if you want to verify that "something" was entered that can't be
done in a textbox event because theoretically your event handler has never
been called.

You also should consider what a pop-up dialog does from a UI viewpoint. If
for instance the text entry has to be 10 characters it can't very well
pop-up a message on the first 9 characters saying "it's too short."
Similarly it can't keep warning "hey it's empty" while the user is making
their way to that textbox.

You could check all the data when the user presses "Ok" but that's a little
late. Ideally the Ok button shouldn't be active until the data is actually
okay.

Tom
Nov 22 '05 #2
"rodger" <pa*@myisland.spam> wrote...
How do i validate text box entry, in VB. net
In the event that user does not make a text entry, simply pop-up a

warning,

Rodger,

It's a little tricky. You can validate text in the textbox in a couple of
events but if you want to verify that "something" was entered that can't be
done in a textbox event because theoretically your event handler has never
been called.

You also should consider what a pop-up dialog does from a UI viewpoint. If
for instance the text entry has to be 10 characters it can't very well
pop-up a message on the first 9 characters saying "it's too short."
Similarly it can't keep warning "hey it's empty" while the user is making
their way to that textbox.

You could check all the data when the user presses "Ok" but that's a little
late. Ideally the Ok button shouldn't be active until the data is actually
okay.

Tom
Nov 22 '05 #3
in the textbox leave event

if textbox.text = "" then
messagebox.show("Fill in the textbox","warning")
'if you want to make sure the user enters something
textbox.focus 'expect some angry users w this one ;p
end if

"rodger" <pa*@myisland.spam> wrote in message
news:Oj**************@TK2MSFTNGP11.phx.gbl...
How do i validate text box entry, in VB. net

In the event that user does not make a text entry, simply pop-up a warning,
thanks

rodger

Nov 22 '05 #4
in the textbox leave event

if textbox.text = "" then
messagebox.show("Fill in the textbox","warning")
'if you want to make sure the user enters something
textbox.focus 'expect some angry users w this one ;p
end if

"rodger" <pa*@myisland.spam> wrote in message
news:Oj**************@TK2MSFTNGP11.phx.gbl...
How do i validate text box entry, in VB. net

In the event that user does not make a text entry, simply pop-up a warning,
thanks

rodger

Nov 22 '05 #5
The best way to set the textbox.causevalidation property to true, then
choose the validating eventhandler.

In the event write your's validating code, and if the textbox.text not
corresponds to the condition, choose the e.cancel.

In that case the user can't leave the textbox, until writes the appropriate
value.

Search for the "Validated event" in the VS help.

Gabor
"rodger" <pa*@myisland.spam> wrote in message
news:Oj**************@TK2MSFTNGP11.phx.gbl...
How do i validate text box entry, in VB. net

In the event that user does not make a text entry, simply pop-up a warning,
thanks

rodger

Nov 22 '05 #6
The best way to set the textbox.causevalidation property to true, then
choose the validating eventhandler.

In the event write your's validating code, and if the textbox.text not
corresponds to the condition, choose the e.cancel.

In that case the user can't leave the textbox, until writes the appropriate
value.

Search for the "Validated event" in the VS help.

Gabor
"rodger" <pa*@myisland.spam> wrote in message
news:Oj**************@TK2MSFTNGP11.phx.gbl...
How do i validate text box entry, in VB. net

In the event that user does not make a text entry, simply pop-up a warning,
thanks

rodger

Nov 22 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Peter | last post by:
Hello: How can I validate the character encoding of the textbox in a form? For instance, when the user fills out a form, I need to be sure that he is typing in English (I mean uses Latin...
3
by: rodger | last post by:
How do i validate text box entry, in VB. net In the event that user does not make a text entry, simply pop-up a warning, thanks rodger
7
by: Chris Kennedy | last post by:
Does anyone know a regular expression that will validate the file extension but also allow multiple file extensions if necessary. It also needs to be case insensitive. Basically, what I want is to...
11
by: wolf | last post by:
There are three webcontrol on my asp.net form: a TextBox, a submit button and a RegularExpressionValidator. And I had set ControlToValidate property of the RegularExpressionValidator to the...
2
by: Peter | last post by:
I need to validate 4 fields on ASP.NET web page Starting Date __/__/____ Starting Time __:__ Ending Date __/__/____ Ending Time __:__ Staring Date + StartingTime...
1
by: eSolTec, Inc. 501(c)(3) | last post by:
Thank you in advance for any and all assistance. I'm trying to validate an email address entered into an input textbox. Does anyone have any code for this? -- Michael Bragg, President...
6
by: NH | last post by:
I want to allow users to enter dates in a text box in either the US "MM dd yy" format or the UK "dd MM yy" format. But how can I validate these dates? All the date functions e.g. ISdate,...
3
by: Jeff Jarrell | last post by:
I have one textbox on a form. Nothing else. The validate event doesn't fire. Drop another textbox on the form and the validate event fires. Set tabstop = false on the 2nd text box and the...
1
by: SkipNRun | last post by:
I am a novice when comes to JavaScript, AJAX. I am working on a form, which will allow users to update their contact information. In order to make the form flexible, I need to use pull down list. ...
1
by: =?Utf-8?B?SGlwSG9wcGVy?= | last post by:
Hi, I have a composited control with a Textbox and a Rangevalidator. If I am not mistaken, Rangevalidator should take currency ($) symbol, but I got the validation error when user enter -$100...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.