Home > Mobile >  How to copy a form and rename everything inside?
How to copy a form and rename everything inside?

Time:04-08

I am copying the AddNewGenreForm form (I want to keep the same control elements and their positions). When renaming the copied form (mouse right click->rename), the other things inside STILL keep the name of the original form instead of AddNewCharacterForm.

When right clicking on the things I want to rename, I don't get an option. How can I rename those things as well to match the form name? If these elements are somehow a reference to the original form, how can I make it so that they are not/create actual copies without referencing?

enter image description here

CodePudding user response:

Those are the method names within that class. You need to rename them in the class file for example AddNewCharacterForm.cs

CodePudding user response:

Thanks to @Jimi I found my answer.

1.Copy the form

2.Rename it with mouse right click rename

3.Go to the file of the form that contains the constructor

4.Rename the class to the form name and rename the constructor to the form name

5.Go to the Designer.cs file of the form

6.Rename the class to the name of the form.

Note that you shouldn't use Visual Studio's rename option when renaming the classes, that would rename your original form's classes as well (because again they share the same name still).

  • Related