Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Form clone
Message
From
09/08/2005 07:28:05
 
 
To
08/08/2005 19:04:02
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
ASP.NET
Category:
Class design
Title:
Miscellaneous
Thread ID:
01039313
Message ID:
01039489
Views:
15
>>>>Right-click on the Form in the Solution Explorer and choose "Copy". Then right-click on the Project and choose "Paste".
>>>
>>>Great!
>>>
>>>> Then, you probably want to rename the file (because it will call it "Copy of MyForm") ... just right-click on it to Rename it. Unfortunately, the IDE is still not smart enough to change any of the code in the Form class when you do this, so you'll need to open up the copied Form (in code view, not in designer view) and change the class name, which will still have the old Form's name). You'll need to change the class name, the constructor, and the a few properties in the generated code (this.Name and this.Text).
>>>
>>>Sure, I can live with that. That is done quickly, and I have to do additional changes anyway.
>>>
>>>One more question: Why didn't the other approaches work? What is going on? For example, create a duplicate of a form in Windows Explorer, and then add it to the project.
>>>
>>>I forgot to mention: Using Visual Studio 2003.
>>
>>Did you make the internal changes? Did you end up with the 2 classes with the same name in the same namespace?
>
>I didn't get the chance to do internal changes, at least, not from within Visual Studio. When I added the second form, only one of the forms showed up.

I just tested it. When I do the 'save as', the original version is automatically excluded from the project, and the new one automatically added. So I click on it and 'include' it before leaving VS.Net, and then save the project. When I come back into it, both are available. Seems a little bizarre to allow 2 classes with the same name in the same workspace, but I didn't try compiling it, so maybe when it compiles, it complains.
Previous
Reply
Map
View

Click here to load this message in the networking platform