Results 1 to 3 of 3

Thread: Clean an entire panel

  1. #1
    rzamith is offline VB.NET Forum Newbie
    .NET Framework
    .NET 1.1 (VS 2003)
    Join Date
    May 2006
    Posts
    5
    Reputation
    0

    Clean an entire panel

    Hi ppl

    Can anyone tell me how to delete every single item from inside a Panel?
    Can't find a reset command or something similar.

    Greetings
    Zamith

  2. #2
    Craig is offline VB.NET Forum Fanatic
    .NET Framework
    .NET 2.0 (VS 2005)
    Join Date
    Oct 2005
    Location
    United Kingdom
    Posts
    110
    Reputation
    97
    Do you want to remove it or hide them, to hide them..

    Code:
             For Each item As Control In myPanel.Controls
                item.Hide()
            Next
    I'm not quite sure how you'd remove them, I tried 'item.dispose()' but this displayed the error "Object reference not set to an instance of an object"
    Last edited by Craig; 06-05-2006 at 1:42 PM.

  3. #3
    JohnH's Avatar
    JohnH is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Dec 2005
    Location
    Norway
    Posts
    14,183
    Reputation
    2368
    Code:
    Panel1.Controls.Clear()
    

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Harvest time tracking