473,654 Members | 3,272 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to test if a control's validating or validate event has fired and is finished

Hi

if i derive a reference to a control on a winform
(ie Control activeControl = somecontrol on the form) how can i test
if that control has a validating or validated event and more
importantly how can i tell that those events have finished so that i
can test for a new situation.

My problem is i am modding some existing code, were the TAB key
keypress is captured by a external c# module.

this module does this

if (keypress)
get current active control

if keypress == tab
move to next control

if (current activecontrol == get current active control)
set focus to mainForm.
This last condition check is causing problems for me because i have
added validating and errorprovider events to text boxes on the form,
and when a validating error occurs the last conditional check, which
of course is checking to see if the control is now a new control,
fires and somehow changing the focus while the error provider is
active, locks me out of being able to click on anything on the form.

I dont have a choice of getting rid of that last conditional check.
So how can i get it to do the last conditional check after a tab
keypress AND after any validating and validated and errorprovider
stuff has finished

any help appreciated

thanks

Peted

Jul 14 '08 #1
2 2677
On Mon, 14 Jul 2008 00:55:32 -0700, <Petedwrote:
if i derive a reference to a control on a winform
(ie Control activeControl = somecontrol on the form) how can i test
if that control has a validating or validated event and more
importantly how can i tell that those events have finished so that i
can test for a new situation.
All controls have the event. Whether they are actually _doing_ anything
depends on the control and how it's used. There's no way for your code to
find that out though, as the event is a private field and not subject to
inspection by your own code. You can of course subscribe to the events
yourself though, and use some kind of flags to track the sequence of the
events being raised.

Whether that would actually address your issue is not at all clear though.
[...]
if (current activecontrol == get current active control)
set focus to mainForm.
This last condition check is causing problems for me because i have
added validating and errorprovider events to text boxes on the form,
and when a validating error occurs the last conditional check, which
of course is checking to see if the control is now a new control,
fires and somehow changing the focus while the error provider is
active, locks me out of being able to click on anything on the form.
[...]
This question doesn't make any sense to me. You are saying that simply
_examining_ the state of your controls is changing the state. That
shouldn't be possible given correct code.

Of course, you didn't post actual code, so it's impossible to say what's
actually happening or how to fix it. You may want to consider providinga
better level of detail in your post.

Pete
Jul 14 '08 #2
On Mon, 14 Jul 2008 09:20:48 -0700, "Peter Duniho"
<Np*********@nn owslpianmk.comw rote:
>
All controls have the event. Whether they are actually _doing_ anything
depends on the control and how it's used. There's no way for your code to
find that out though, as the event is a private field and not subject to
inspection by your own code. You can of course subscribe to the events
yourself though, and use some kind of flags to track the sequence of the
events being raised.

Whether that would actually address your issue is not at all clear though.
>[...]

i think you are correct it would prob be best for me to try some flag
setup to track the events bieng fired. I should have thought of that,
but i was trying to be too clever about it

thanks

Peted
Jul 18 '08 #3

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

Similar topics

0
1060
by: Bevo | last post by:
I validate my textbox input data on its Validating-event. But what if the textbox has focus when I click on the windows close button? Then I dont want to validate - at least not until I've confirmed the 'Do you want to save your changes?' question Since the textbox's Validating is fired before the form's Closing event, how can I cancel the Validating? Whats the best way to deal with this standard issue?
5
17077
by: Dennis C. Drumm | last post by:
Is there a way to prevent the user from leaving a tab on a TabControl until all the controls on that tab have finished validating? The problem I am experiencing is when a control fails its validating event and the user clicks another tab things get messy. Ideally, I think the best solution is not to leave a tab until the validating event has completed successfully. Thanks,
6
5788
by: Alex Bink | last post by:
Hi, I have a validating event on a textbox in which I want to prevent the user to leave the textbox without entering the right data. Only if he clicks on another specific control he is allowed to leave the textbox without entering the right information. Is there a way to determine which other control was clicked in the validating event of the textbox? Thanks
7
7762
by: | last post by:
Hello to all I'm handling the Validating event for one text box. If something is wrong in user input I show a warning message. The problem is that if I add to method the message is displayed twice (event fired twice). Without event is fired once. if(txtMSG.Length > 0) {
1
1325
by: Visual Systems AB \(Martin Arvidsson\) | last post by:
Hi! I have written a simple validating event for a couple of textbox's on a form. They validate just fine when leaving the form, now for the problem. If i click a button to begin execution, i want to validate all the textforms before it can proceed. I have tried to send validate to the form, but it just wont validate. Do i
0
2458
by: Matthew | last post by:
All, I have searched google and the newsgroups but can't find anything the same as what I am experiencing (though I may have missed something). I have controls (textboxes) within UserControls which are not behaving as I would expect. Specifically, if there is a command button external to the usercontrol which is activated by a shortcut key (eg Alt-B), the command button Click event handler code 'executes' even though the textbox set...
5
9337
by: norton | last post by:
Hi All, I am writing a simple win form which contains a button, when user click the button i want to validate all the other textbox and see if there is anything goes wrong may i know how can i trigger the validating event for all text box? thx and regard,s
2
1525
by: weboweb | last post by:
Hail the experts!!! I'm creating a web user control which displays a hierarchical tree of items from an xml string passed to the control (from the host page) through an exposed property. This xml gets created in the Page_Load method of the host page Each tree item displayed by the control is a LinkButton object. This LinkButton fires a CommandEventHandler event (when the user
3
1969
by: Hamed | last post by:
Hello I have a Data Entry Form having some controls including a TextBox. When the user types an entry, I query a table and if it was entered before, I ask the user (using ShowModal method of a custom message form) if he wants to see his old entry in a new form. if he/she choose Yes, I create a new form and show the previously entered data in it. The problem is when I create and show the new form, the validating event is fired two...
0
8379
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8294
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
8816
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
8709
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
7309
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
6162
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
4150
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...
1
2719
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1924
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.