.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 9th, 2012, 04:16 PM
IMaVBNoob's Avatar
IMaVBNoob IMaVBNoob is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 122 IMaVBNoob User rank is Private First Class (20 - 50 Reputation Level)IMaVBNoob User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 13 h 57 m 38 sec
Reputation Power: 8
Send a message via MSN to IMaVBNoob
Removing panels Not! controls!

ive found countless examples for removing controls from a form but i need to remove panels from my form... ill try to explain...

when the user pushes the "+" button a panel is created and added to the form. Then various controls, a link to act as a delete button and 2 more panels are created inside of said panel to create the look that I want. So the combination of controls and panels should act as a custom control so to speak but not really. these combination of panels and controls are created inside of a inner scrolling panel and the inner scrolling panel is inside of a outter panel to allow the inner panel to scroll when the up or down button is pushed. When a new panel is created it is incremented down and added to the inner scrolling panel so the user is able to add as many as they want to the form and be able to scroll through them.

i am trying to figure out the delete button. which is the linklable sub below

now my question is why is this not removing the first panel completely instead of disposing of only the resources in said panel?

Code:
Private Sub LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
        Dim i As Integer
        Dim x As Integer
        i = dellink(num).Tag
        x = 1
        Dim controlname As String = "Step" & i
        Dim objectsToBeFound As System.Windows.Forms.Control() = InnerStepContainer.Controls.Find(controlname, True)

        Dim FoundPanel As Panel = DirectCast(objectsToBeFound(0), Panel) ' pick the first and maybe only control found in the array and put maki it a panel object

        InnerStepContainer.Controls.RemoveByKey(FoundPanel.Name) 'remove the panel object from the hosting form
        FoundPanel.Dispose() ' free any resources occupied by this

        actioncombo3(i).Dispose()
        actiontextbox1(i).Dispose()
        actiontextbox2(i).Dispose()
        actiontextbox3(i).Dispose()
        actionlabel1(i).Dispose()
        actionlabel2(i).Dispose()
        actionlabel3(i).Dispose()
        actionlabel4(i).Dispose()
        actionlabel5(i).Dispose()
        actiontextbox4(i).Dispose()
        actiontextbox5(i).Dispose()
        actionlabel6(i).Dispose()
        actionarray1(i) = Nothing
        actionvalue1(i) = Nothing
        actionvalue2(i) = Nothing
        actionvalue3(i) = Nothing
        actionvalue4(i) = Nothing
        actionvalue5(i) = Nothing
        actionvalue6(i) = Nothing
        actionvalue7(i) = Nothing
        ReLoadProject()
    End Sub



I hope that wasn't to confusing. Please help
And thanks ahead of time

Reply With Quote
  #2  
Old September 22nd, 2012, 02:13 PM
AceInfinity AceInfinity is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2012
Posts: 14 AceInfinity User rank is Private First Class (20 - 50 Reputation Level)AceInfinity User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 h 49 m 21 sec
Reputation Power: 0
You're not doing anything to remove the controls.

Code:
?.Controls.Remove(PanelName)


Use Controls methods.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > Removing panels Not! controls!

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap