Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Showing multiple forms

In my code I have a main form (named frmMain) and an About Box(named AboutBox1). What I want to happen is when the user clicks on the Help menu in my menu strip and then clicks on About I want the AboutBox1 form to show. I've researched on how to do it but the intellisense is not recognizing the second form when I try and type and I have no idea why. Any ideas?

The code that I'd assume that I put in my menu button click even is:

AboutBox1 aboutbox = new aboutbox();
aboutbox.ShowDialog();

however AboutBox1 gives an error that the type or namespace could not be found.

Here is the code I currently have. Along with this is also a newly created form that has nothing but the initial code in it:

https://gist.github.com/anonymous/5366535

like image 873
Mark Shimala Avatar asked Apr 10 '26 07:04

Mark Shimala


1 Answers

Try this :

AboutBox1 aboutbox = new AboutBox1();
aboutbox.ShowDialog();

ShowDialog() creates a modal window, if you need to create a modeless window you can use Show() method.


in C#

the typical way to initialize a object is

Classname variable_name = new Classname(); // assuming that constructor does not take any parameter

Go though this article once : Objects (C# Programming Guide) it will help you to understand a few basic things.

like image 178
Parimal Raj Avatar answered Apr 12 '26 19:04

Parimal Raj



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!