Windows Develop Bookmark and Share   
 index > Windows Forms General > Events checking
 

Events checking

i would like to ask about checking an event handler in another event...
for example, in the button A click event, I would like to check if button B click event occurred or not?
So, any idea on writing this without using any control variables?
thank you
cosmicX  Monday, August 13, 2007 11:50 AM

It is impossible to do something like this without control variables. You will need to add a boolean field or something. You could make some type of custom control (say a control derived from Button), that if it is ever clicked sets one of its properties to true (WasClicked or something). That would help clean up the code if you needed several of the buttons, but it is just moving the variables from the form to the control -- you still need them somewhere.

sirjis  Monday, August 13, 2007 1:13 PM

It is impossible to do something like this without control variables. You will need to add a boolean field or something. You could make some type of custom control (say a control derived from Button), that if it is ever clicked sets one of its properties to true (WasClicked or something). That would help clean up the code if you needed several of the buttons, but it is just moving the variables from the form to the control -- you still need them somewhere.

sirjis  Monday, August 13, 2007 1:13 PM
Oh, I know it can be done with a control variable...
I thought delegate can work well in this case...
thx for the reply
cosmicX  Tuesday, August 14, 2007 2:14 AM

You can use google to search for other answers

Custom Search

More Threads

• Char-toggled checkbox?
• Thread::Sleep question
• Forms display incorrectly in different resolutions
• Wrapping NativeWindow in UserControl
• Manual Scrollbar implementation in a Form
• Theme text positioning
• Installation and Removal
• RichTextBox row height
• Unable to get on screen keyboard usercontrol to write to other windows than the parent app
• User Control