Home All Groups Group Topic Archive Search About
Author
12 May 2006 3:35 PM
mrmagoo
If I create a form and add add a bunch of controls and code, etc to it, I
can see that Visual Studio adds all of the requisite "creation" code behind
the form.

If I wanted to create a 2nd copy of the exact form, how would I go about
that? Could I just copy the code from the first form, including the
Windows-generated code, and paste it in the code-behind of the 2nd form? I
see that there is a warning not to modify the code-behind using the code
editor, but to instead use the Form Designer. Does that mean what I ask is a
bad idea?

If so, what's the easiest way to add a 2nd form with exactly the same
controls, events, etc?

Thanks.

Author
12 May 2006 3:45 PM
Chris
mrmagoo wrote:
Show quoteHide quote
> If I create a form and add add a bunch of controls and code, etc to it, I
> can see that Visual Studio adds all of the requisite "creation" code behind
> the form.
>
> If I wanted to create a 2nd copy of the exact form, how would I go about
> that? Could I just copy the code from the first form, including the
> Windows-generated code, and paste it in the code-behind of the 2nd form? I
> see that there is a warning not to modify the code-behind using the code
> editor, but to instead use the Form Designer. Does that mean what I ask is a
> bad idea?
>
> If so, what's the easiest way to add a 2nd form with exactly the same
> controls, events, etc?
>
> Thanks.
>
>

No, your way will work fine.  You could also just copy the .vb files for
it and add it to your new project.  The warning is just, a warning, you
can make changes but if you do something incorrect the designer might
not work.  Make sure to change the class name once you copy it.

Chris
Author
12 May 2006 5:19 PM
mrmagoo
Thanks!

Show quoteHide quote
"Chris" <no@spam.com> wrote in message
news:ef9hvsddGHA.4428@TK2MSFTNGP03.phx.gbl...
> mrmagoo wrote:
> > If I create a form and add add a bunch of controls and code, etc to it,
I
> > can see that Visual Studio adds all of the requisite "creation" code
behind
> > the form.
> >
> > If I wanted to create a 2nd copy of the exact form, how would I go about
> > that? Could I just copy the code from the first form, including the
> > Windows-generated code, and paste it in the code-behind of the 2nd form?
I
> > see that there is a warning not to modify the code-behind using the code
> > editor, but to instead use the Form Designer. Does that mean what I ask
is a
> > bad idea?
> >
> > If so, what's the easiest way to add a 2nd form with exactly the same
> > controls, events, etc?
> >
> > Thanks.
> >
> >
>
> No, your way will work fine.  You could also just copy the .vb files for
> it and add it to your new project.  The warning is just, a warning, you
> can make changes but if you do something incorrect the designer might
> not work.  Make sure to change the class name once you copy it.
>
> Chris
Author
12 May 2006 11:43 PM
Dennis
Everytime I try your approach, I seem to screw up the designer code somehow. 
I have reverted to creating a new form then copying all the controls to it.
--
Dennis in Houston


Show quoteHide quote
"mrmagoo" wrote:

> Thanks!
>
> "Chris" <no@spam.com> wrote in message
> news:ef9hvsddGHA.4428@TK2MSFTNGP03.phx.gbl...
> > mrmagoo wrote:
> > > If I create a form and add add a bunch of controls and code, etc to it,
> I
> > > can see that Visual Studio adds all of the requisite "creation" code
> behind
> > > the form.
> > >
> > > If I wanted to create a 2nd copy of the exact form, how would I go about
> > > that? Could I just copy the code from the first form, including the
> > > Windows-generated code, and paste it in the code-behind of the 2nd form?
> I
> > > see that there is a warning not to modify the code-behind using the code
> > > editor, but to instead use the Form Designer. Does that mean what I ask
> is a
> > > bad idea?
> > >
> > > If so, what's the easiest way to add a 2nd form with exactly the same
> > > controls, events, etc?
> > >
> > > Thanks.
> > >
> > >
> >
> > No, your way will work fine.  You could also just copy the .vb files for
> > it and add it to your new project.  The warning is just, a warning, you
> > can make changes but if you do something incorrect the designer might
> > not work.  Make sure to change the class name once you copy it.
> >
> > Chris
>
>
>
Author
13 May 2006 8:15 AM
Simon Verona
I just do it by copying and pasting the form, in the solutions explorer in
the designer.    You just need to change the class name and the form name in
the initialisation code (it will come up as a compiler error so it's easy to
find).

HTH
Simon

--
================================
Simon Verona
Dealer Management Service Ltd
Stewart House
Centurion Business Park
Julian Way
Sheffield
S9 1GD

Tel: 0870 080 2300
Fax: 0870 735 0011

Show quoteHide quote
"Dennis" <Den***@discussions.microsoft.com> wrote in message
news:48DEC692-7425-4662-B71B-F9FAE5BC85CC@microsoft.com...
> Everytime I try your approach, I seem to screw up the designer code
> somehow.
> I have reverted to creating a new form then copying all the controls to
> it.
> --
> Dennis in Houston
>
>
> "mrmagoo" wrote:
>
>> Thanks!
>>
>> "Chris" <no@spam.com> wrote in message
>> news:ef9hvsddGHA.4428@TK2MSFTNGP03.phx.gbl...
>> > mrmagoo wrote:
>> > > If I create a form and add add a bunch of controls and code, etc to
>> > > it,
>> I
>> > > can see that Visual Studio adds all of the requisite "creation" code
>> behind
>> > > the form.
>> > >
>> > > If I wanted to create a 2nd copy of the exact form, how would I go
>> > > about
>> > > that? Could I just copy the code from the first form, including the
>> > > Windows-generated code, and paste it in the code-behind of the 2nd
>> > > form?
>> I
>> > > see that there is a warning not to modify the code-behind using the
>> > > code
>> > > editor, but to instead use the Form Designer. Does that mean what I
>> > > ask
>> is a
>> > > bad idea?
>> > >
>> > > If so, what's the easiest way to add a 2nd form with exactly the same
>> > > controls, events, etc?
>> > >
>> > > Thanks.
>> > >
>> > >
>> >
>> > No, your way will work fine.  You could also just copy the .vb files
>> > for
>> > it and add it to your new project.  The warning is just, a warning, you
>> > can make changes but if you do something incorrect the designer might
>> > not work.  Make sure to change the class name once you copy it.
>> >
>> > Chris
>>
>>
>>