Click here to Skip to main content
15,888,239 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can We copy a Form with all Design/Coding with another Form Name in C Sharp Windows Application.

So that we may save time at design/copy time

If, Yes HOW

Please Help me
Posted

Wel you can copy the from as mentioned by "Praveen Kullu" but i will suggest you to make "User Control" and use it on multiple forms, it is easy and better approach.
Writing your Custom User Control[^]
 
Share this answer
 
v2
Comments
Praveen Kullu 12-Nov-11 0:16am    
Well said..
Yes, you can copy all From design with code. Method explain above by Praveen
But don't forget to change namesapce and classname.
 
Share this answer
 
Yes you can..

Copy the form design first: say Form1.cs[Design]
to another form. say Form2.cs[Design]

then copy all the form1 code to form2 code;
i.e Form1.cs to Form2.cs

Do these things after that:

In the code for form 2, change this to
C#
public partial class Form1 : Form
    {
      public Form1()
        {


C#
public partial class Form2 : Form
    {
      public Form2()
        {


If the controls in form2 have to be same as in form1, then you don't need to change anything else.

Look for any controls that could get missing. Just remove them from resources.
 
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