473,545 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Simple ErrorProvider question

I've never used this little control, but found a reason too. So, I want to
prevent the user from moving on, until the error condition has been
satisified. I have a textbox and raise the Validated event that does the
errorchecking. If an error exists, i don't want the user to move on, what's
the best way to handle this?

Doug
Jan 24 '06 #1
2 1072
Doug,

If there is an error, then you should set the Cancel property on the
CancelEventArgs instance passed to your Validating event handler to true.
This will cause the focus NOT to shift.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Doug Handler" <dk*******@yaho o.com> wrote in message
news:OZ******** ******@TK2MSFTN GP12.phx.gbl...
I've never used this little control, but found a reason too. So, I want
to prevent the user from moving on, until the error condition has been
satisified. I have a textbox and raise the Validated event that does the
errorchecking. If an error exists, i don't want the user to move on,
what's the best way to handle this?

Doug

Jan 24 '06 #2
You want to check for errors in the Validating event, not the Validated
event, and then, as Nicholas pointed out, set the Cancel property of
the ValidatingEvent Args to false in order to stop the focus change.

The Validated event is useful if you need code to take action _only if_
the validation succeeded and the user is about to leave the field as a
result.

Jan 24 '06 #3

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

Similar topics

3
5517
by: Martijn Leine | last post by:
I am using an errorprovider and a datagrid component on a form. I use the errorprovider to display error hints in the grid, in the case the entered data by the user is checked and not found Ok. After the data is corrected, the hint does not disappear ! (the exclamation mark however, does disappear). For Microsoft: If I'm correct, and it...
6
9846
by: M O J O | last post by:
Hi, How do I check if an ErrorProvider has errors? Take for example this code... (err = ErrorProvider...) Public Sub Test If TextBox1.Text= "" Then
0
1321
by: Issac | last post by:
Hi, I am writing a program which will be used in Win2000 and Win98 platform. The program include a Form (called myForm) which has a TextBox, Tooltip, Errorprovider and a Button. Tooltip will be set with TextBox content and Errorprovider will be set in TextBox Validating event if it is empty. The Button is actually pop (ShowDialog)...
8
1269
by: Abul Hasan | last post by:
Hello everyone, I have placed simple validation through ErrorProvider Class on my textBoxes to check whether ther r empty or not Error Provider Class check and catches the error but it doesn't stop saving the record. For instance if I click on any other button on the form it doesn't stop user from doing so. How can I stop or restrict user...
3
2611
by: Jeppe Jespersen | last post by:
I read the following - regarding the ErrorProvider control - in the MOC Course Material for course 2373: "You can set your own error messages manually, as shown in the following example, or when working with bound data, you set the DataSource propertyof the ErrorProvider to automatically pick error messages up from thedatabase." So,...
2
6929
by: Lenster | last post by:
I'm having problems using the errorprovider in VB.NET to automatically display an error icon next to textboxes bound to the same dataset as the errorprovider. The sequence of events is : Build a dataset containing a single table. Bind the textboxes on a windows form to the datatable. Bind the errorprovider control to the same datatable....
4
3800
by: ljlevend | last post by:
I have the following issues: 1. I want to make it so that ToolTips never go away once they are shown until the user moves the mouse outside of the control for which the ToolTip is assigned. It seems to me that setting the ToolTip.AutoPopDelay to a large value (e.g., Int32.MaxValue) should acomplish this goal, but it does not. 2. I want...
5
1654
by: Alvaro Lamas | last post by:
I have a problem with the ErrorProvider with a mdi interface, I have a MDI form which opens a child form, that child form uses the errorprovider to show the problems with the data entry. The problem happens when I use the show method of the child form it will try to validate the first field and since it need to not empty and its just opening...
3
1400
by: J L | last post by:
I have a from with an ErrorProvider on it. I pass a reference of the form to a subroutine where I want to reference the ErorrProvider. I could pass it in the call to the subroutine, but I would like to dreive it from the reference to the form that I am already passing. Can this be done? TIA John
4
1458
by: Freeon | last post by:
How do I capture the hover event on the ErrorProvider control? I created a custom control and inherited the ErrorProvider. Problem is I don't know which method to override to capture the hover event. I want to popup a custom form instead of the default tooltip. Any help would be greatly appreciated. Thanks, Christian
0
7470
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7405
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...
0
7811
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...
0
7760
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5975
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...
1
5334
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...
0
4949
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...
0
3455
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...
0
3444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.