G
gol
Hi,
I have an invisible button in my form. I have a timer
(System.Windows.Forms.Timer) with interval 300 ms. In the timer tick event I
check for a certain flag, and if that flag is true, the button becomes
visible (After setting the flag's status to false again).
The problem is that if the event happened and the button became visible, and
then I closed the form, and then reopened it and let the event happen again,
then the operation of making the button visible throws an exception of type
System.ObjectDisposedException.
It looks like when I reopen the form, I already haven't got the button. One
could think it's been Garbage Collected, but I'm not sure about that, because
the button is part of the form which is reopened (Form f = new Form(); ).
Can someone please explain the source of the problem and the solution?
Thanks a lot
I have an invisible button in my form. I have a timer
(System.Windows.Forms.Timer) with interval 300 ms. In the timer tick event I
check for a certain flag, and if that flag is true, the button becomes
visible (After setting the flag's status to false again).
The problem is that if the event happened and the button became visible, and
then I closed the form, and then reopened it and let the event happen again,
then the operation of making the button visible throws an exception of type
System.ObjectDisposedException.
It looks like when I reopen the form, I already haven't got the button. One
could think it's been Garbage Collected, but I'm not sure about that, because
the button is part of the form which is reopened (Form f = new Form(); ).
Can someone please explain the source of the problem and the solution?
Thanks a lot