Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hi all,
i have a form which suppose to show some controls in a panel.
now u have managed to get the functinality i need, but the performance is quite poor and also the stabilty.

so i have 2 controls inside a panel container:
this.splitContainer.Panel2.Controls.Add(ctrl1);
this.splitContainer.Panel2.Controls.Add(ctrl2);


now i want to switch between them according to some button_click event.
it doesn't work.

my app works now with this code:
this.splitContainer.Panel2.Controls.Clear();
this.splitContainer.Panel2.Controls.Add(ctrl);
this.splitContainer.Panel2.Show();


anyone has an idea?

thx!
Posted

I am not sure what you meant by switching between panels.

did you mean that you want to clear all the controls from Panel2 and add them to panel 1 ??

The code that you added here should be working, but is this what you needed ?

:confused:
 
Share this answer
 
hi Abhishek Sur,
i don't want to switch bewteen panels. rather, i have 1 Panel, which contains 2 Controls. i want to switch the visibility of the Controls such that in every moment either ctrl1 or ctrl2 is displayed.

once again, i don't want to use the Clear() and Add() methods, because they invoke the VisibilityChanged Event, hwich i would like to use.

thx!
 
Share this answer
 

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