Link to home
Start Free TrialLog in
Avatar of mathieu_cupryk
mathieu_cuprykFlag for Canada

asked on

the about dialog.

I added the about dialog to my windows application.

private void btnAbout_Click(object sender, EventArgs e)
        {
            InitialPrices.AboutBox.ShowDialog();
        }
Error      6      An object reference is required for the nonstatic field, method, or property 'System.Windows.Forms.Form.ShowDialog()'      C:\SvnWork\InitialPriceReporting\DotNet\InitialPriceReporting\Form1.cs      1443      13      InitialPriceReporting

Now the code for About.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using System.Reflection;

namespace InitialPrices
{
    partial class AboutBox : Form
    {
        public AboutBox()
        {
            InitializeComponent();

            //  Initialize the AboutBox to display the product information from the assembly information.
            //  Change assembly information settings for your application through either:
            //  - Project->Properties->Application->Assembly Information
            //  - AssemblyInfo.cs
            this.Text = String.Format("About {0}", AssemblyTitle);
            this.labelProductName.Text = AssemblyProduct;
            this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion);
            this.labelCopyright.Text = AssemblyCopyright;
            this.labelCompanyName.Text = AssemblyCompany;
            this.textBoxDescription.Text = AssemblyDescription;
        }
what should i do?
ASKER CERTIFIED SOLUTION
Avatar of oxyoo
oxyoo
Flag of Sweden image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mathieu_cupryk

ASKER

u have to create an instance then call the method showdialog throught that instance?
Yes that is correct, the ShowDialog method is not a static method. Therefor you need to first create an instance of the dialog class and call ShowDialog on that instance.