J# rookie: need help with multiple forms

Hi,

Firstly, thanks to anyone who responds!

I have only about a month's worth of experience using .NET and J#, and a semester's worth of Java (a year ago). Needless to say, I'm no expert.

I'm building an application that has about twenty separate Windows Forms. I have a Main Menu Form that I would like to be the application's welcome screen, and is intended to direct the user to other parts of the application through the use of clicking several buttons. For instance, there is an "Administration" button that should open an Administration Menu Form; there is another button entitled "Data Entry" that should open a Data Entry Menu Form.

I have already built the other Forms separately, and added them to one Solution.

I have named the Main Menu Form "frmMainMenu"; the Administration Form is entitled "frmAdminMenu".

My issue is that I don't know the code to place in the respective button event handlers that will call and open these other Forms. Also, I don't know if there is an "import" (or similar) statement that I need at the top of the code that will enable the Main Menu Form to recognize/call the Administration Form; and, if so, what is the correct syntax

Here is the sample code for the Admininstration Menu button:

private void cmdAdmin_Click (Object sender, System.EventArgs e)

{

//WHAT CODE GOES HERE

}

I've searched several usenets and websites. I'm not sure of the correct questions to ask, so any help would be greatly, greatly appreciated.

Many thanks,

Paul



Answer this question

J# rookie: need help with multiple forms

  • tim.rachel

    Once again, thank you very much for the response.

    I've modified your code to adapt to my own class names.  It got me going in the right direction.  I also had to make a few other changes, but I have figured out my problem.

    Again, thank you!!!!

    Regards,

    Paul


  • Muerte33

    private void cmdAdmin_Click (Object sender, System.EventArgs e)

    {

    frmAdminMenu MyForm = new frmAdminMenu();
    MyForm.Show()

    }


    Done!



  • martinez1

    Hi,

    You are getting blank form as you are instantiating the default blank form only. You need to instantiate the form which represents your admin menu.

    Let's say the class of Form which reprsents your admin menu form is AdminMenuForm. Then you need to write...

    AdminMenuForm frmAdminMenu = new AdminMenuForm();

    frmAdminMenu.Show();

    Hope it helps.

    Thanks.



  • EricCS07

    Thanks for the fast response!

    However, I'm still having a problem. I'm currently using the following code in the event handler:

    private void cmdAdmin_Click (Object sender, System.EventArgs e)

    {

    Form frmAdminMenu = new Form();

    frmAdminMenu.Show();

    }

    This code will open a new form, but it is a generic blank form, and not the appropriate Administration menu that I am attempting to call. I think I only need the correct "import" statement, or something similar, but I don't know the correct one.

    Any ideas

    Thanks again!

    -Paul


  • J# rookie: need help with multiple forms