# C# Question



## pcpro17 (Oct 9, 2006)

Hello. I'm relatively new to C#. I've got a C# application that I inheritted from the previous guy here, and I need to make some modifications to it. I've added an About box/form to the Help menu. Does anyone know how/where I can link the About option in the Help menu to the About box, so that it will appear? Where is that kind of launch code usually located?

Also, this application has a bunch of auxillary windows that launch when it starts. Where is this code usually located. I recall that MFC had a function for Paint. Is this does the same way with C#?

I am using C# 2005 Express Edition.

Thanks.


----------



## artur02 (Sep 24, 2007)

I think you've added an About menu item to the Help menu. Just select your *About menu item and doubleclick* on it. It will create a method which will execute when you click on the menu item.
Simply instanciate your _About box_ and add the _.Show()_ or _.ShowDialog()_ code to this method.

Auxillary windows: Check _Program.cs_ and _OnLoad()_ methods for them.


----------



## pcpro17 (Oct 9, 2006)

Hello artur. Thank you for the assistance. I can kind of see what you are talking about. However, I'm still having a little trouble. Maybe some additional details will help. (Unfortunately, I cannot give out too much due to legal restrictions...)

In frmMain.cs I have this code:

```
private void aboutToolStripMenuItem1_Click(object sender, EventArgs e)
        {
//            AboutBox1.ActiveForm.ShowDialog();
        }
```
And in AboutBox1.cs there is this:

```
private void AboutBox1_Load(object sender, EventArgs e)
        {
//            ShowDialog();
        }
```
I'm not certain that I have either of these setup correctly. Any thoughts?

Also, I'm having a little trouble finding the initialization code you mentioned. Program.cs contains only some auto-generated code:

```
static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new frmMain());
        }
    }
```
And, OnLoad does not appear anywhere in the project files. Any other thoughts? Might it be a property in these forms?

Thanks.


----------



## metweek (Jun 7, 2003)

Try This

```
private void aboutToolStripMenuItem1_Click(object sender, EventArgs e)
        {
             AboutBox1 = new AboutBox1();
             AboutBox1.ShowDialog();
        }
```


----------



## artur02 (Sep 24, 2007)

pcpro17 said:


> Hello artur. Thank you for the assistance. I can kind of see what you are talking about. However, I'm still having a little trouble. Maybe some additional details will help. (Unfortunately, I cannot give out too much due to legal restrictions...)
> 
> In frmMain.cs I have this code:
> 
> ...


The '//' means the line is a comment, so the first two methods don't do anything.
The

```
Application.Run(new frmMain());
```
 line means the first form appearing on the screen is a new instance of *frmMain class*, what is actually a Form.


----------

