UserControl delete from Form

Discussion in 'Microsoft Dot NET Framework' started by Mark, Apr 30, 2009.

  1. Mark

    Mark Guest

    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
     
    Mark, Apr 30, 2009
    #1
    1. Advertisements

  2. Mark

    Pavel Minaev Guest

    On Apr 30, 12:54 am, Mark <> wrote:
    > 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.
     
    Pavel Minaev, Apr 30, 2009
    #2
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. Guest

    Socket Connect problem in UserControl hosted in IE

    Guest, Jul 8, 2003, in forum: Microsoft Dot NET Framework
    Replies:
    2
    Views:
    2,812
    Chris Willis
    Jul 21, 2003
  2. Jeff Laretto

    ResouceManager problems in IE embeded WinForum usercontrol

    Jeff Laretto, Dec 10, 2003, in forum: Microsoft Dot NET Framework
    Replies:
    0
    Views:
    251
    Jeff Laretto
    Dec 10, 2003
  3. Olivier R
    Replies:
    0
    Views:
    247
    Olivier R
    Jan 30, 2004
  4. CV

    Problem With Winforms UserControl on VS.net design time

    CV, Mar 1, 2004, in forum: Microsoft Dot NET Framework
    Replies:
    2
    Views:
    376
    Christian Kuendig
    Mar 6, 2004
  5. Virgilio

    Hosting an UserControl in IE and Sockets with .NET 1.1

    Virgilio, Mar 24, 2004, in forum: Microsoft Dot NET Framework
    Replies:
    0
    Views:
    294
    Virgilio
    Mar 24, 2004
  6. Guest

    Adding an About Property in UserControl

    Guest, Mar 26, 2004, in forum: Microsoft Dot NET Framework
    Replies:
    4
    Views:
    247
    Lloyd Sheen
    Mar 28, 2004
  7. Gybas Petr

    Windows UserControl and Class Library

    Gybas Petr, Apr 3, 2004, in forum: Microsoft Dot NET Framework
    Replies:
    0
    Views:
    194
    Gybas Petr
    Apr 3, 2004
  8. Indhu Balasubramaniam

    DateTimePicker control on a Tabcontrol in a userControl - Hangs

    Indhu Balasubramaniam, Apr 12, 2004, in forum: Microsoft Dot NET Framework
    Replies:
    2
    Views:
    491
    Indhu Balasubramaniam
    Apr 15, 2004
Loading...