473,387 Members | 1,515 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,387 software developers and data experts.

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 2653
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*********@nnowslpianmk.comwrote:
>
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
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...
5
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...
6
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...
7
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...
1
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...
0
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...
5
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...
2
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...
3
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...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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...
0
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,...
0
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...
0
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...

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.