Click here to Skip to main content
15,747,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I know how to add objects like

ProgressBar PROB = new ProgressBar();
this.grid0.Children.Add(PROB);


but how do i remove the objects?
Posted

1 solution

You can use Remove Operator like this

C#
ProgressBar PROB = new ProgressBar();
            this.Grid0.Children.Add(PROB);
            this.Grid0.Children.Remove(PROB);


Hope this helps
 
Share this answer
 
Comments
[no name] 13-Jun-11 5:19am    
well i'm doing somthng like this..... ProgressBar PROB = new ProgressBar();

if ((this.Height < 134) | (this.Width < 409))
{
this.grid0.Children.Add(PROB);
}
if ((this.Height > 134) | (this.Width > 409))
{
this.grid0.Children.Add(PROB);
this.grid0.Children.Remove(PROB);
}


.....
Wayne Gaylard 13-Jun-11 5:21am    
Why?
Sergey Alexandrovich Kryukov 13-Jun-11 5:22am    
It it a question?
--SA
[no name] 13-Jun-11 5:31am    
yes, the code isn't working
Pete O'Hanlon 13-Jun-11 11:15am    
I'm not surprised. You are creating a local variable called PROB and then adding it in, in both cases (I'm not sure why). In the second instance, you remove the new instance of PROB, not the instance you added in the first place.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900