Hello,
I have a form that deals with customers applications. The form splits in two panels. First panel is common for all applications (has to do with application number, application date, personal statement etc), second panel though is according to Application Type (Application Type is a combobox which being filled in the first panel). So, according to the application type value a different panel has to be called.
Is is possible to build panels as User Controls and call them when are needed instead of having 10 different panels loaded invisible all the time.
I'm looking forward hearing your opinions on this.
Loading

Danatas GerviRank #4,152 · 361 reputationPosted Sep 2, 2009, 7:55 AM EDT
Simplest way – add panel on to User Control.
User Control have no border property – the panel on it – allow to define border from designer , and so on….
Danatas GerviRank #4,152 · 361 reputationPosted Sep 2, 2009, 4:43 AM EDT
You can use
this.Controls.Remove(..);
this.Controls.Add(..);
To remove unnessary control and to add another.
DealyRank #9,518 · 205 reputationPosted Sep 2, 2009, 7:05 AM EDT
Thank you
Swetha Srinivasan12 reputationPosted Sep 4, 2009, 2:48 AM EDT
//UserControl1 and UserControl2 are the user controls which you have to add UserControl1 userControl1=new UserControl1 (); UserControl2 userControl2=new UserControl2 (); private void button1_Click(object sender, EventArgs e) {//panel2 is the name of the panel on which you want to add the user control panel2.controls.add(userControl1); } private void button2_Click(object sender, EventArgs e) { panel2.controls.Clear(); panel2.controls.add(userControl2); }