473,670 Members | 2,353 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 8483
"rodger" <pa*@myisland.s pam> 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.s pam> 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","warni ng")
'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.s pam> wrote in message
news:Oj******** ******@TK2MSFTN GP11.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","warni ng")
'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.s pam> wrote in message
news:Oj******** ******@TK2MSFTN GP11.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.causeva lidation 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.s pam> wrote in message
news:Oj******** ******@TK2MSFTN GP11.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.causeva lidation 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.s pam> wrote in message
news:Oj******** ******@TK2MSFTN GP11.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
4247
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 characters - not Russian, Hebrew etc.). Do you know any JS code sample that I could use? I would appreciate your help. Thank you,
3
399
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
25374
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 validate a file input box to check if the extension is the correct type, i.e. .doc for a Word Document etc. Also I would like to check multiple file types, for instance allow a gif or a jpeg or a jpg. Regards, Chris.
11
2117
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 TextBox. But now, when I input a string in the textbox and press Enter key, the form was submit without client javascript validate. Why? And what should I do to enable client validate before submit the form whethe press Enter key or click Submit...
2
1354
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 can not be later then Ending Date + Ending Time (the starting and ending Times are dropdown boxes) How would I validate these two values with Validator Controls?
1
2105
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 eSolTec, Inc. a 501(C)(3) organization MS Authorized MAR
6
2886
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, convert.ToDatetime etc fail on the US date format as the application and IIS is set to UK format. Its strange that the date format("12/03/06","MM dd yy") is interpretated correctly but format("12/22/06","MM dd yy") bombs out.
3
1922
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 validate event on textbox1 doesn't fire again. I now it sounds silly with only one tab stop but it is for a barcode scanner. scan, scan, scan, esc. Thats it. help... I need a work around.
1
3989
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. Depends on the pull down list selection, I use script.aculo.us to validate the user input before submit and pass the necessary data, such as contact type, contact information and ranking to a php program for updating. This form should allow multiple...
1
3160
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 in the text box. It will succeed if -100. So I tried add a property called "MoneyValue", return a Decimal only value and use , hopping RangeValidator
0
8388
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8907
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8817
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7423
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6218
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5687
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4396
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.