marcbo

How can I determine what events are still running while i am in an event.

For example : I have a panel build with 1000 textboxes at runtime. (each textbox is a like a cel in a spreadsheet)

In the keyeventhandler keydown i catch the keys (up,down,left,right) to move the focus to another textbox (cel) in the panel. Moving the focus to another textbox (cel) in the panel starts other events(events enter , event leave, ...).

Is there a way to know if there are still events being executed (events that are not finished) while I am in an event. With the information of events still being running ,I can decide to do Aplication.DoEvents() or change the way an event must behave.




Re: Visual C# General events still running c#

frederikm

Hi

seeing as there is but one gui thread, there are no other events still running... unless you are doing those on a background thread

the event handler blocks the execution of the thread untill finished.

Hope this helps, please close the thread if it does






Re: Visual C# General events still running c#

Mark Dawson

> Is there a way to know if there are still events being executed (events that are not finished) while I am in an event

Can you give a concrete example of what you mean in the above, what are you trying to accomplish, or what issue are you having

Thanks

Mark.






Re: Visual C# General events still running c#

theblueeyz

Ok, you need to seriously ask yourself if your current program design is reasonable - using thousands of textboxes does not sound reasonable to me. If what you want are cells, use something that inherently handles cells - a DataGridView. The DataGridView provides more than enough events for you to determine the direction arrows being pressed (and if those don't help, set your main form's KeyPreview to True and handle KeyDown in the main form). Then ask the DataGridView what the current cell row and column are, and move the current cell accordingly.

This way you can avoid the question you're asking altogether.





Re: Visual C# General events still running c#

Figo Fei - MSFT

Hi,

Actually the concept is the event being fired but not being excuted. When the event is being fired, it delegate a method or methods to process the stuff. If you want to excute sth when an event fired, just put the method into the delegate corresponding to the event. That's it!

Thank you