Click here to Skip to main content
15,921,697 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am having a panel in Winform which loads panels in to it in run time during a method call. It is done using below code:

C#
//Adding a child panel
Panel p = new Panel();

//Adding controls to panel
Label lbl5 = new Label();
lbl5.Location = new Point(105, 3);
lbl5.Text = note.noteName;
Label lbl6 = new Label();
lbl6.Location = new Point(105, 43);
lbl6.Text = note.noteName;

//Adding child panel to main panel
Panel1.Controls.Add(p);


In this way whenever the method is called a new child panel will be added to main panel.

My requirement is whenever user clicks on a child panel in the main panel, the child panel detail is required...after that the value of controls present in child panel...As i am loading child panel dynamically, can i do any method call() for child panel ???

Any suggestion !!!
Posted
Updated 3-Nov-15 0:48am
v2

1 solution

Yes, you can find the control by its name from the parent control.
Use Control.ControlCollection.Find.[^]
C#
var ctrl = Panel1.Controls["Your Control Name"];


-KR
 
Share this answer
 
Comments
Digambar Malla 3-Nov-15 6:49am    
Rohit, thanks for the response...I have updated my question...please check for the exact requirement...
Krunal Rohit 3-Nov-15 6:55am    
What is exactly you want to do ?

-KR

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