mathieu_cupryk
asked on
the about dialog.
I added the about dialog to my windows application.
private void btnAbout_Click(object sender, EventArgs e)
{
InitialPrices.AboutBox.Sho wDialog();
}
Error 6 An object reference is required for the nonstatic field, method, or property 'System.Windows.Forms.Form .ShowDialo g()' C:\SvnWork\InitialPriceRep orting\Dot Net\Initia lPriceRepo rting\Form 1.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->Appli cation->As sembly 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.Te xt = AssemblyDescription;
}
what should i do?
private void btnAbout_Click(object sender, EventArgs e)
{
InitialPrices.AboutBox.Sho
}
Error 6 An object reference is required for the nonstatic field, method, or property 'System.Windows.Forms.Form
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->Appli
// - AssemblyInfo.cs
this.Text = String.Format("About {0}", AssemblyTitle);
this.labelProductName.Text
this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion);
this.labelCopyright.Text = AssemblyCopyright;
this.labelCompanyName.Text
this.textBoxDescription.Te
}
what should i do?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
ASKER