Hello!
OK.
It is very easy.
I have timer (System.Threadi ng.Timer)
......
TimerCallback timerCallback = new TimerCallback(s omeFunction);
tmr = new Timer(timerCall back, null, 0, 5000);
......
public delegate void SomeEventHandle r(object sender, someEventArgs e);
public static event SomeEventHandle r someEvent;
public static void someFunction(ob ject status) {
if (someEvent != null) {
someEvent(null, new SomeEventArgs(m _someParam));
}
}
Some Forms gets this event:
.......
someEvent += new SomeEventHandle r(form_someEven t);
.......
And in Dispose:
.......
someEvent -= new SomeEventHandle r(form_someEven t);
.......
When user click on menuItem in ContextMenu i open dialog -
.......
someDialog.Show Dialog();
.......
and when user click 'OK' or 'Cancel' button on dialog i write
.......
DialogResult = DialogResult.OK ;
Close();
.......
That is my code. If i comment generating event everything is ok. But
if event generates - everything crashed. I`ve tryed make it with
standart Control, like ListView, and everything was fine. - So i think
that trouble is in attaching of ContextMenu to my Control.
Best Regards, Vladimir.
You showed us the code that works but not the code that doesn't work. Can
you provide a sample of how you're calling the dialog, what events you're
"sending" and how, and how you're closing your dialog.
To make it easier to duplicate your problem, strip out any unneeded code and
test what you send us to make sure it still demonstrates the symptoms you're
describing.
DalePres
MCAD, MCDBA, MCSE
"Zieben" wrote:
Hello!
I have such problem!
I have my UserControl. I override property ContextMenu for this
Control as
.....
new ContextMenu ContextMenu{
set {_contextMenu = value;}
get {return _contextMenu;}
}
.....
This code works. But if i open new Window using this context menu (for
example New Dialog) and send event to this Dialog my dialog dont get
event and after closing this form my application hangs.
I knew, that problem is in ContextMenu (specially in set_ContextMenu ),
but i dont understand what is wrong.
Please, help!!!!
Best Regards, Vladimir.