avinash_takale
asked on
How to copy panels in C#
Hi Experts,
I need some help from you.
I am creating one application in which i want to create bunch og control in a panel and that same panel I want to copy not Move to some other location
When I copy then there will be two panel but unfortunately there is only one panel with different location.
Please provide me solution ASAP.
Thanks
-Avinash
I need some help from you.
I am creating one application in which i want to create bunch og control in a panel and that same panel I want to copy not Move to some other location
When I copy then there will be two panel but unfortunately there is only one panel with different location.
Please provide me solution ASAP.
Thanks
-Avinash
ASKER
thanks a lot
but can you explain if panel one contains one text box and i want to create another panel i.e. panel2 at runtime with same content as panel 1.
can give me some more detail regarding how to code
please........
give me code its reallly urgent.
thanks in advance
but can you explain if panel one contains one text box and i want to create another panel i.e. panel2 at runtime with same content as panel 1.
can give me some more detail regarding how to code
please........
give me code its reallly urgent.
thanks in advance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
sorry to say but the PlaceHolder control works with Webform and not with windows form
so can you tell me other alternative.
Really helpful this code for me.
-Avinash
so can you tell me other alternative.
Really helpful this code for me.
-Avinash
Sorry about that, in that case you can use the Position property of the Panel. This will specify the X,Y coordinates of where to place the Panel on the screen and you can drop out all occurences of the placeholder from my code.
//Create new panel in specific location
ForEach Control in OriginalPanel.GetControls(
ControlCopy = Control;
ControlCopy.ID = Control.ID + "Copy";
PanelCopy.Controls.Add(Con
Next
This should create copies of all the controls into the new panel and keep their original ID's, but append "Copy" to then end. The reason you have to append this is because you cannot have two controls of the same name in one form.