Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Delegates
Message
From
13/06/2003 21:56:33
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Delegates
Miscellaneous
Thread ID:
00800062
Message ID:
00800062
Views:
60
I have a question about using Delegates in a Windows Form.

I have a DialogForm that can be called several times from the same place (it's basically a form for the user to specify search criteria). It's called like this from a button Click event:
   if (this.oFinder == null)
       this.oFinder = new FinderForm();
   if (this.oFinder.ShowDialog() == DialogResult.OK)
   {
       // processing code goes here
   }
Because this.oFinder is never released, the DialogForm still exists. This is by design. When the user clicks on the button again to bring up the Finder Form another time, his previous search criteria is still shown, so that he is able to change only what needs changing in order to search again (without having to fill in all the data again). OK, this works great, but there's one glitch:

The form has a few ComboBoxes with Delegates for the SelectedIndexChanged events. The first time the form is loaded, this works fine. But after that, the SelectedIndexChanged events fire way too many times and give unexpected results. It seems that the easiest way to fix this would be to be able to basically disable the Delegates until I'm ready to assign them again, instead of having them already assigned every time the form shows.

I hope I've explained this clearly enough. Does anybody have any clue as to whether you can disable or turn off a Delegate once it's been assigned?

TIA,
~~Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Next
Reply
Map
View

Click here to load this message in the networking platform