Rookie Form Question

  • Thread starter Thread starter Dave Guenthner
  • Start date Start date
D

Dave Guenthner

I have a csharp form1.cs created with VS. I have added a menu bar
with one option called help. I then created another form in VS called
help.cs. How can I launch the help form from the main form called
form1.

Seems simple.

private void menuItem5_Click(object sender, System.EventArgs e)
{
// Menuitem5_Click is the help menu item user sees
// Call help.cs
help.Gives me a bunch of methods like ActiveForm etc
}

Any suggestions. Basically I want to design a "help" form in VS and
then call it from my main form.

Thanks,

Dave
 
Hello, Dave!


(new help()).Show();
or
help h=new help();
h.Show();

Second way allows you to do something
with the form before showing it.

You wrote on 5 Nov 2004 21:19:03 -0800:

DG> Seems simple.

DG> private void menuItem5_Click(object sender, System.EventArgs e)
DG> {
DG> // Menuitem5_Click is the help menu item user sees
DG> // Call help.cs
DG> help.Gives me a bunch of methods like ActiveForm etc
DG> }

DG> Any suggestions. Basically I want to design a "help" form in VS and
DG> then call it from my main form.

DG> Thanks,


With best regards, Nurchi BECHED.
 
HelpForm hf = new HelpForm();
hf.Show(); // or hf.ShowDialog() to show it in modal form

I have a csharp form1.cs created with VS. I have added a menu bar
with one option called help. I then created another form in VS called
help.cs. How can I launch the help form from the main form called
form1.

Seems simple.

private void menuItem5_Click(object sender, System.EventArgs e)
{
// Menuitem5_Click is the help menu item user sees
// Call help.cs
help.Gives me a bunch of methods like ActiveForm etc
}

Any suggestions. Basically I want to design a "help" form in VS and
then call it from my main form.

Thanks,

Dave
 
Thanks Guys! That allowed me to do exactly what I wanted. Create /
Design a form with VS and call it from main form.

Dave
 
Dave, if you take shivas suggestion to show the form as a dialog, it is good
practice to handle the dialogresult of the form (if applicable)....it is
something that gets overlooked a lot in the early days of Win Form
programming.

// Display the form as a modal dialog box.
form1.ShowDialog();

// Determine if the OK button was clicked on the dialog box.
if (form1.DialogResult == DialogResult.OK)
{
// Display a message box indicating that the OK button was clicked.
MessageBox.Show("The OK button on the form was clicked.");
// Optional: Call the Dispose method when you are finished with the
dialog box.
form1.Dispose();
}
else
{
// Display a message box indicating that the Cancel button was
clicked.
MessageBox.Show("The Cancel button on the form was clicked.");
// Optional: Call the Dispose method when you are finished with the
dialog box.
form1.Dispose();
}
 
Back
Top