UserControl delete from Form

M

Mark

Hi,

I write Windows Forms 2.0 application.
I have Form and I add dynamically a lot of UserControl to the form.
Than one of the user control has event (for example buutton click) and
I would like to delete all the controls from Form and add new one.

When in the same event I try to delete control, I have exceptions..
Why ?

How to delete (Dispose) controls from Form in user control event - in
one event ?

Thanks for help
 
P

Pavel Minaev

I write Windows Forms 2.0 application.
I have Form and I add dynamically a lot of UserControl to the form.
Than one of the user control has event (for example buutton click) and
I would like to delete all the controls from Form and add new one.

When in the same event I try to delete control, I have exceptions..
Why ?

Show the code that causes the exception, code of the user control, and
provide the description of that exception (type, message text etc).
Without it, there's no way to tell.
How to delete (Dispose) controls from Form in user control event - in
one event ?

Removing control from a form, and disposing the control, are two very
different things.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top