tags:

views:

693

answers:

4

Hello. I have an About box in my C# project using Microsoft's Visual C# 2008 Express Edition named AboutBox1. I have made it look how I want it in the design view, but how do I make it appear when the About link in the Help menu is clicked?

This codes makes an About box appear, but it looks blank. It's not the one I designed.

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

Any thoughts or suggestions would be appreciated. Thanks.

+1  A: 

It sounds to me like a borked designer surface... have you hit save and rebuilt it? Perhaps close the IDE, reopen it, and check that your carefully designed form is still pretty?

BTW, when using ShowDialog you should also use using (since it doesn't Dispose() itself when shown with ShowDialog):

using(AboutBox1 box = new AboutBox1()) {
    box.ShowDialog(this);
}
Marc Gravell
+2  A: 

Did you remove the method-call to 'InitializeComponent' in the constructor of your AboutBox - form ?

Your constructor should at least look like this:

    public partial class AboutBox : Form
    {
        public AboutBox()
        {
            InitializeComponent ();
        }
    }

Where the InitializeComponent method call should be the first line in the constructor.

Frederik Gheysels
if you remove the InitializeComponent() from the constructor you will recieve a run time exception.
Mike
No, you won't get a runtime exception. Have you tried it ?Create a new winforms-project, add a button on the form, and remove the InitializeComponent line from the constructor ...
Frederik Gheysels
A: 

If it appears but is blank, the problem is in AboutBox1. Show us some of that code.

McAden
+2  A: 

Got it.

The about box is driven off of assembly properties for your project.

Go to Project -> 'ProjectName' Properties -> Assembly Information.

You set all of the information there.

If you try to set the information in the Property Explorer it will simply be over written at run time by what ever is in this window.

Cheers, Mike

Mike
Thanks for the heads up, Mike!
Jim Fell