Removing controls in runtime

Discussion in 'Questions (Windows Mobile)' started by Stanl3yCZ, Feb 18, 2008.

  1. Stanl3yCZ

    Stanl3yCZ Member

    Is it possible to remove some control in runtime? I need to remove it, not just make it invisible. Thanks.
     
  2. willisgt

    willisgt Active Member Licensed User

    You should dispose of the control using one of two methods:

    1. If you created the control in the designer and know the name, you can dispose of it in this manner:

    Textbox1.Dispose

    2. If you create the control dynamically, you'll have to keep track of the name of the control until you want to dispose of it:

    AddLabel( formName, controlName, left, top, width, height, text )
    ...
    Control( controlName ).Dispose


    Gary
     
Loading...