Home All Groups Group Topic Archive Search About
Author
6 Dec 2006 4:17 AM
Eric D. Anderson
Well I am somewhat new to programming in c#. And I am having a hard time figuring out how to open up a 2nd form within my program.

Here is what I am wanting to do:

When I click the "about" option from the menuStrip within my program, I want it to open up a form that I created, and show the user the information about my program.

I have already created the About form that I want to use, but I don't know how to make it show up when the about option is clicked. Any suggestions?

--
Eric D. Anderson

Author
6 Dec 2006 7:20 AM
Peter Duniho
"Eric D. Anderson" <timexxai***@email.uophx.edu> wrote in message
news:uVMGI1OGHHA.3464@TK2MSFTNGP05.phx.gbl...
> [...]
> I have already created the About form that I want to use, but
> I don't know how to make it show up when the about option is
> clicked. Any suggestions?

Generally speaking, to show a form you must first create an instance of it,
and then call the Show method.  For example:

    AboutForm afrm = new AboutForm();

    afrm.Show;

You may want your About form to be modal.  That is, to not allow any
interaction with other windows in the process while it's showing.  In that
case, you can call the ShowDialog method instead of Show.

Hope that helps.  By the way, please don't post to newsgroups using HTML.
Plain text is appropriate here.

Pete
Author
6 Dec 2006 1:00 PM
cbmeeks
That should be afrm.Show();  but Eric was on the right track.  :-)

Also, if you are spawning the new form within a MDI container, add this
BEFORE you call the Show() method:

afrm.MdiParent = this;

By using "this", I am assuming you have setup your main form as a MDI
container.

Good luck!
cbmeeks
----------------------------------------------------------------
Are you a Programmer??
http://www.codershangout.com

C#, .NET, SQL, and more!



Peter Duniho wrote:
Show quote
> "Eric D. Anderson" <timexxai***@email.uophx.edu> wrote in message
> news:uVMGI1OGHHA.3464@TK2MSFTNGP05.phx.gbl...
> > [...]
> > I have already created the About form that I want to use, but
> > I don't know how to make it show up when the about option is
> > clicked. Any suggestions?
>
> Generally speaking, to show a form you must first create an instance of it,
> and then call the Show method.  For example:
>
>     AboutForm afrm = new AboutForm();
>
>     afrm.Show;
>
> You may want your About form to be modal.  That is, to not allow any
> interaction with other windows in the process while it's showing.  In that
> case, you can call the ShowDialog method instead of Show.
>
> Hope that helps.  By the way, please don't post to newsgroups using HTML.
> Plain text is appropriate here.
>
> Pete
Author
6 Dec 2006 7:26 PM
Peter Duniho
"cbmeeks" <cbme***@gmail.com> wrote in message
news:1165410053.056197.34990@79g2000cws.googlegroups.com...
> That should be afrm.Show();  but Eric was on the right track.  :-)

Yeah, yeah...picky, picky.  :)
Author
6 Dec 2006 6:53 PM
Eric D. Anderson
Thanks a lot you guys for your help. I finally figured it out. Just like
Peter had said I needed to call the show method.

--
Eric D. Anderson
"Eric D. Anderson" <timexxai***@email.uophx.edu> wrote in message
news:uVMGI1OGHHA.3464@TK2MSFTNGP05.phx.gbl...
Well I am somewhat new to programming in c#. And I am having a hard time
figuring out how to open up a 2nd form within my program.

Here is what I am wanting to do:

When I click the "about" option from the menuStrip within my program, I want
it to open up a form that I created, and show the user the information about
my program.

I have already created the About form that I want to use, but I don't know
how to make it show up when the about option is clicked. Any suggestions?

--
Eric D. Anderson

AddThis Social Bookmark Button