G
Guest
I have a SideForm. If the use presses a button on the main form, the side
form comes up by executing the following:
SideForm sf = new SideForm()
sf.ShowDialog();
This works perfectly.
I've been asked to change the code to the following:
SideForm sf = new SideForm();
sf.Show();
The idea is that the user should not be excluded from using the main form
while the side form is visible. This works fine, except if the user closes
the side form and clicks the button re-open the side form. On re-open, I get
the following exception:
Cannot access a disposed object.
Object name: 'SideForm'
I've tried to play games with disposing and deleting the object. What I'd
really like to know is how to invoke the behavior of ShowDialog(), so that I
don't have dispose of every "new"ed third party control control on the side
form (there's a lot of them).
Thanks,
form comes up by executing the following:
SideForm sf = new SideForm()
sf.ShowDialog();
This works perfectly.
I've been asked to change the code to the following:
SideForm sf = new SideForm();
sf.Show();
The idea is that the user should not be excluded from using the main form
while the side form is visible. This works fine, except if the user closes
the side form and clicks the button re-open the side form. On re-open, I get
the following exception:
Cannot access a disposed object.
Object name: 'SideForm'
I've tried to play games with disposing and deleting the object. What I'd
really like to know is how to invoke the behavior of ShowDialog(), so that I
don't have dispose of every "new"ed third party control control on the side
form (there's a lot of them).
Thanks,