Remove a dynamic control


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Remove a dynamic control

  1. #1
    Join Date
    Jul 2004
    Posts
    366

    Question Remove a dynamic control

    Good Afternoon All,

    I've created some comboboxes dynamically based upon how many items are in a listview. I'm trying to remove them when I press a button. Can anyone guide me to a resource that can help with this.

    Everything I try doesn't work, for example:

    Dim cbo As ComboBox = Nothing
    For x = 1 To ilvItems
    cbo.Name = "cbo" & lvApplications.Items(x).text
    Controls.Remove(cbo)
    Next x

    Dim matchedControls As Control() = Me.tpSetAccess.Controls.Find("cbo" & lvApplications.Items(x).Text, False)

    'Dim matchedControls As Control() = Me.Controls.Find("btn" & i.ToString(), False)

    For Each control As Control In matchedControls
    '// Only remove the buttons
    If TypeOf (control) Is ComboBox Then
    Me.Controls.Remove(control)
    End If
    Next
    Next

    Any ideas????


    Thanks...

    jb
    Last edited by jcb1269; 01-15-2010 at 02:17 PM.

  2. #2
    Join Date
    Jul 2004
    Posts
    366

    Talking I got it....

    Created all the controls in a panel and then just cleared the panel. Short and sweet.



    jb

Similar Threads

  1. Actipro Wizard 2.0 Released (Windows Forms Control)
    By Actipro Software Support in forum dotnet.announcements
    Replies: 0
    Last Post: 03-16-2003, 08:40 PM
  2. Actipro Wizard 1.03 .NET Control Released
    By Actipro Software Support in forum dotnet.announcements
    Replies: 0
    Last Post: 09-29-2002, 11:30 PM
  3. How long before the next version??
    By _CAG in forum .NET
    Replies: 146
    Last Post: 08-12-2002, 11:40 PM
  4. Re: App Object (fixes)
    By Rob Teixeira in forum .NET
    Replies: 129
    Last Post: 06-06-2002, 06:23 AM
  5. Question on Dynamic Control Creation
    By Shravan in forum VB Classic
    Replies: 0
    Last Post: 06-05-2002, 09:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center