p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

csharptoday_discuss thread: How to open a form from another form...


Message #1 by "L. Roovario" <lroov@h...> on Thu, 6 Dec 2001 23:42:30
I have created a main form using the form designer.  I want to add another 

form, created with the designer, to the project and open it by clicking on 

a button in the main form.  Is there an easy way to do this?  What do I 

need to put in the button code?  I can't find a single example in my books 

or the Web.  If you could point me to one I would be very pleased.



Thanks!

-Larry
Message #2 by "alan eliason" <astech@q...> on Thu, 06 Dec 2001 15:48:21 -0800
Is anyone using Build 9412, the latest release, and can figure out how to use

localhost with IIS?  Even starting IIS is quite a puzzle.



Alan





"L. Roovario" wrote:



> I have created a main form using the form designer.  I want to add another

> form, created with the designer, to the project and open it by clicking on

> a button in the main form.  Is there an easy way to do this?  What do I

> need to put in the button code?  I can't find a single example in my books

> or the Web.  If you could point me to one I would be very pleased.

>

> Thanks!

> -Larry






Message #3 by "craigw" <craigw@w...> on Fri, 7 Dec 2001 16:36:57
Hi Larry



to open Form2 from the click event handler of a button on Form1, do the 

following in Form1's button event handler:







   private void button1_Click(object sender, System.EventArgs e)

   {

      Form2 myForm = new Form2();

      myForm.Show();

	

   }





hope this helps,

Craig



> I have created a main form using the form designer.  I want to add 

another 

> form, created with the designer, to the project and open it by clicking 

on 

> a button in the main form.  Is there an easy way to do this?  What do I 

> need to put in the button code?  I can't find a single example in my 

books 

> or the Web.  If you could point me to one I would be very pleased.

> 

> Thanks!

> -Larry
Message #4 by "craigw" <craigw@w...> on Fri, 7 Dec 2001 16:42:02
Hi Alan



not sure what you mean here - IIS and Visual Studio .NET should be quite 

separate, any problems with IIS shouldn't be due to VS. Do you mean you 

are having trouble creating web applications?



Craig





> Is anyone using Build 9412, the latest release, and can figure out how 

to use

> localhost with IIS?  Even starting IIS is quite a puzzle.

> 

> Alan

Message #5 by "alan eliason" <astech@q...> on Fri, 07 Dec 2001 09:24:52 -0800
Yes, I cannot develop Web applications.  With the newest version of Visial Studio.NET,

IIS is not installed.  Rather, you must install Visual Studio, setup IIS and they

reinstall, according to others.  For me, this does not work.  Without IIS,

attempting to run a simple Web application leads to the message, cannot find

http://localhost/WebProject1, even though this has worked with earlier betas.



Do you know of anythink I might read to help me with the setup of both localhost

and IIS for the new version?  I believe I am doing someting slightly wrong, as

everything else seems to work.  Finally, I should add that I am running MS 2000,

service pack2, and VisualStudio.NET Build 9412(RC3).



Thanks for your return message and any help you might provide or lead me to.  I have

spent a week on this issue and it is quite draining.



Alan Eliason





craigw wrote:



> Hi Alan

>

> not sure what you mean here - IIS and Visual Studio .NET should be quite

> separate, any problems with IIS shouldn't be due to VS. Do you mean you

> are having trouble creating web applications?

>

> Craig

>

> > Is anyone using Build 9412, the latest release, and can figure out how

> to use

> > localhost with IIS?  Even starting IIS is quite a puzzle.

> >

> > Alan

>






Message #6 by "Gerald Leslie" <leslie@a...> on Mon, 10 Dec 2001 09:53:59
hello,

 If you have added a new form in the design time. Then you should use the 

ID of the form to open the form. So in the button click event you just give



name.show();



here name is the ID of the form which is newly created. Because ID is the 

instance of the form.



regards,

leslie

  Return to Index