Making a copy of a form...

  • Thread starter Thread starter Brad Pears
  • Start date Start date
B

Brad Pears

I have some major changes I want to make to a form. So, I copy/pasted the
original form within my project and renamed the pasted form to
{formname}_new.frm.

However, when I test the project, I get all kinds of errors because of the
duplicate functions etc... that exist within the original form.

How do I compile/run my project but exclude the original form from being
included in the project compilation so as not to get the duplicate errors
etc....? I do however still want it as part of my project...

Thanks, Brad
 
I have some major changes I want to make to a form. So, I copy/pasted the
original form within my project and renamed the pasted form to
{formname}_new.frm.

However, when I test the project, I get all kinds of errors because of the
duplicate functions etc... that exist within the original form.

How do I compile/run my project but exclude the original form from being
included in the project compilation so as not to get the duplicate errors
etc....? I do however still want it as part of my project...

Thanks, Brad

You renamed the object right? Not just the file?
 
I have some major changes I want to make to a form. So, I copy/pasted the
original form within my project and renamed the pasted form to
{formname}_new.frm.

However, when I test the project, I get all kinds of errors because of the
duplicate functions etc... that exist within the original form.

How do I compile/run my project but exclude the original form from being
included in the project compilation so as not to get the duplicate errors
etc....? I do however still want it as part of my project...

Thanks, Brad

Have you considered "inheritance" if works for you with uncertainity?
 
You must remember to rename the class inside the Form.vb file. Let's
say that you copy and paste a form called MyForm1, renaming the second
one in the solution explorer to MyForm1Copy, the MyForm1Copy.vb file
will say Public Class MyForm1 at the beginning. You need to change it
to say Public Class MyForm1Copy.

In addition, you must edit the MyForm1Copy.Designer.vb file to replace
instances of the text "MyForm1" with "MyForm1Copy".

HTH...
Bob
 
Brad,

I do it in two way, using the method Bob is giving or like this:

I create a new Form with the name xCopy

In the original form while the code part I select all code (ctrl A), and
*Cut* the code (not copy), direct folowed by ctrl Z.

Then I go to my new form again and I remove all code (in fact I do ctrl A)
and past the clipboard.

Then as Bob wrote as well, I rename the classname to xCopy.

This seems long however in fact this go faster than the methode Bob shows,
which I use as well in certain circumstances.

Cor
 
I right-click & Copy the file in Solution Explorer, then Paste it. I then
right-click and rename the "Copy Of.." file name, then I open the code and
type the new name over the old one. N.B. You can't use Right-click>Rename
because then it will also rename the designer code of the original form.


--
David Streeter
Synchrotech Software
Sydney Australia
 
Back
Top