|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
New to C#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 "Eric D. Anderson" <timexxai***@email.uophx.edu> wrote in message Generally speaking, to show a form you must first create an instance of it, 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? 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 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 "cbmeeks" <cbme***@gmail.com> wrote in message Yeah, yeah...picky, picky. :)news:1165410053.056197.34990@79g2000cws.googlegroups.com... > That should be afrm.Show(); but Eric was on the right track. :-) 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 Well I am somewhat new to programming in c#. And I am having a hard time news:uVMGI1OGHHA.3464@TK2MSFTNGP05.phx.gbl... 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 |
|||||||||||||||||||||||