G
garyusenet
Dear Professionals,
I have recently been using the wonderful krypton toolkit and am trying
to use them in my small hobby application. I include this bit of info
as an aside really because i'm sure my question can be extrapolated to
the more general case, so here goes!
I have a box standard windows forms project. (File, New Project,
Windows Application, OK)
I have added a form2 to this project using the Add New Item button, and
then choosing Windows Form. So far so simple.
However I want to use a form from an existing project. I have two
versions of Visual Studio lets say A and B.
A - has the solution open that has a form in that I want to use.
B - has my live working project in it. I would like the form from
version A in B.
First I tried right clicking the form in the solution explorer of A,
and then pasting it into the solution explorer of B. That didn't work
however i got the message that 'The source file for this operation
cannot be found in this solution'.
So next I tried creating a new form in B. using Add new Item, and
choosing windows form. I copied the contents of the forms code in
question from solution A, and pasted this over the top of the newly
created forms code in version B, so that I had entirely replaced the
wizard generated code in version B with the form I actually wanted from
version A. I noticed that the form appearance now looked right, but
that none of the controls appeared on the form. So I went back to the
original form on version A that I was trying to replicate, and used
Edit Select All. I then went back into my half created form in version
B, and pasted these controls. Now my form in version B looked identical
to the form in version A. So I had thought I had triumphed!
If you are still with me thankyou very much, this isn't easy to explain
in words, so i'm sure it's even harder to understand!
However I have a problem in that I can not display my newly created
form!
At the moment my program.cs in version B (the version of Visual Studio
that has my live project i'm working with) has the following as it's
main method: -
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Form2 frm = new Form2();
if (frm.ShowDialog() == DialogResult.OK)
{
Application.Run(new Form2(frm.UserName));
}
}
The new form i've created using the above processes is called 'form3'
however if i change Form2 above to read Form3 and run the programme i'm
told that the 'type of namespace Form3' could not be found. I have
tried changing the case so that it reads form3, but this also doesn't
work. I have tried saving the solution, (CTRL SHIFT S = save all) and
it still doesn't work. Yet when I view solution explorer my form3 is
sitting pretty and smiling back at me, I can see it and it's listed as
form3 in the solution explorer.
Any ideas please why this isn't displaying would be greatly, greatly
appreciated!
Please excuse the diatribe above but I have re read and re read it, and
despite the fact that my need is fairly simple - (wanting to use a form
from another project in a new project) I couldn't find a terser way of
putting it!
Thankyou,
Gary.
I have recently been using the wonderful krypton toolkit and am trying
to use them in my small hobby application. I include this bit of info
as an aside really because i'm sure my question can be extrapolated to
the more general case, so here goes!
I have a box standard windows forms project. (File, New Project,
Windows Application, OK)
I have added a form2 to this project using the Add New Item button, and
then choosing Windows Form. So far so simple.
However I want to use a form from an existing project. I have two
versions of Visual Studio lets say A and B.
A - has the solution open that has a form in that I want to use.
B - has my live working project in it. I would like the form from
version A in B.
First I tried right clicking the form in the solution explorer of A,
and then pasting it into the solution explorer of B. That didn't work
however i got the message that 'The source file for this operation
cannot be found in this solution'.
So next I tried creating a new form in B. using Add new Item, and
choosing windows form. I copied the contents of the forms code in
question from solution A, and pasted this over the top of the newly
created forms code in version B, so that I had entirely replaced the
wizard generated code in version B with the form I actually wanted from
version A. I noticed that the form appearance now looked right, but
that none of the controls appeared on the form. So I went back to the
original form on version A that I was trying to replicate, and used
Edit Select All. I then went back into my half created form in version
B, and pasted these controls. Now my form in version B looked identical
to the form in version A. So I had thought I had triumphed!
If you are still with me thankyou very much, this isn't easy to explain
in words, so i'm sure it's even harder to understand!
However I have a problem in that I can not display my newly created
form!
At the moment my program.cs in version B (the version of Visual Studio
that has my live project i'm working with) has the following as it's
main method: -
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Form2 frm = new Form2();
if (frm.ShowDialog() == DialogResult.OK)
{
Application.Run(new Form2(frm.UserName));
}
}
The new form i've created using the above processes is called 'form3'
however if i change Form2 above to read Form3 and run the programme i'm
told that the 'type of namespace Form3' could not be found. I have
tried changing the case so that it reads form3, but this also doesn't
work. I have tried saving the solution, (CTRL SHIFT S = save all) and
it still doesn't work. Yet when I view solution explorer my form3 is
sitting pretty and smiling back at me, I can see it and it's listed as
form3 in the solution explorer.
Any ideas please why this isn't displaying would be greatly, greatly
appreciated!
Please excuse the diatribe above but I have re read and re read it, and
despite the fact that my need is fairly simple - (wanting to use a form
from another project in a new project) I couldn't find a terser way of
putting it!
Thankyou,
Gary.