#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Posts
    117
    Rep Power
    11

    How to get a C# About box to work


    Hi I do not know if this forum is for C# questions.

    I have a basic desktop app and I want to get my About box to pop up when I go to Help -> About from a menu. I have the menu and the exent but annoyingly it opens up a microsoft About box
    Saying Version 1.0.0.0.1.0.0.0
    Copywrite Microsoft
    Microsoft.

    This is not my About box.

    Code:
            private void About_MenuItem_Click(object sender, EventArgs e)
            {
                Form frm = new AboutInterest();
                frm.Left = (this).Left + 50;
                //frm.Right = (this).Right + 50;  // Doesn't like this line? Property or indexer 'System.Windows.Forms.Control.Right' cannot be assigned to -- it is read only
    
                frm.ShowDialog();
            }
    TIA

    Desmond.
  2. #2
  3. JavaScript is not spelt java
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2011
    Location
    Landan, England
    Posts
    743
    Rep Power
    165
    Did a quick test and it works for me. I removed the following lines from the about-box code:

    Code:
                //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;
    and the corresponding controls from the form. Perhaps you have added two about boxes and AboutInterest is a previous (unaltered) version?

    BTW You can set Left and Top but not Right (which is just Left in disguise!).
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    5
    Rep Power
    0

    Re:-


    Visual C# Express is put together from pieces.
    One of those pieces is the C# compiler; the compiler (and some related components) translates your programs from C# text into a format that can be run on your computer. Another piece is the "Class Libraries"; Class Libraries are "classes" that extend C# and give it the power to do things such as read/write files or create Windows forms.

    Thanks.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    3
    Rep Power
    0
    1) new AbtInterest() - make sure that AbtInterest is the class name of the form you expected would open. You can even (in Visual Studio) right click the AbtInterest and go to it's declaration from there - make sure the file you expected to open - opens.

    2) You can't set the .Right parameter because it is derived from the .Size parameter. Set .Size by giving it a new Size.

    Code:
    frm.Location = new Point(top, left);
    frm.Size = new Size(width, height);

IMN logo majestic logo threadwatch logo seochat tools logo