We help IT Professionals succeed at work.

Make an about box in c#

kyrenator
kyrenator asked
on
Medium Priority
1,853 Views
Last Modified: 2012-05-06
Plz tell how can i make an about box in c#.I want this about box to shows Name,Version,Product
Comment
Watch Question

Commented:
Try something like this:
using System;
    using System.Windows.Forms;
    using System.Drawing;
 
  public class AboutBox : Form {
    public String Author="java2s";
    public String AppName = "about dialog";
    public String Version = "1.0";
 
    public AboutBox ()
    {
      InitDialog ();
    }
 
    private void InitDialog ()
    {
      this.ClientSize = new Size (250, 140);
      this.Text = "About";
      this.FormBorderStyle  = FormBorderStyle.FixedDialog;
      this.ControlBox    = false;
      this.MinimizeBox  = false;
      this.MaximizeBox  = false;
 
      Button wndClose = new Button ();
      wndClose.Text = "OK";
      wndClose.Location = new Point (90, 100);
      wndClose.Size = new Size (72, 24);
      wndClose.Click += new EventHandler (About_OK);
 
      Label wndAuthorLabel = new Label ();
      wndAuthorLabel.Text = "Author:";
      wndAuthorLabel.Location = new Point (5, 5);
      wndAuthorLabel.Size = new Size (72, 24);
 
      Label wndAuthor = new Label ();
      wndAuthor.Text = Author;
      wndAuthor.Location = new Point (80, 5);
      wndAuthor.Size = new Size (80, 24);
 
      Label wndProdNameLabel = new Label ();
      wndProdNameLabel.Text = "Product:";
      wndProdNameLabel.Location = new Point (5, 30);
      wndProdNameLabel.Size = new Size (72, 24);
 
      Label wndProdName = new Label ();
      wndProdName.Text = AppName;
      wndProdName.Location = new Point (80, 30);
      wndProdName.Size = new Size (120, 24);
 
      Label wndVersionLabel = new Label ();
      wndVersionLabel.Text = "Version:";
      wndVersionLabel.Location = new Point (5, 55);
      wndVersionLabel.Size = new Size (72, 24);
 
      Label wndVersion = new Label ();
      wndVersion.Text = Version;
      wndVersion.Location = new Point (80, 55);
      wndVersion.Size = new Size (72, 24);
 
      this.Controls.AddRange( new Control [] {
                        wndClose,
                        wndAuthorLabel,
                        wndProdNameLabel,
                        wndVersionLabel,
                        wndAuthor,
                        wndProdName,
                        wndVersion
                        });
      this.StartPosition = FormStartPosition.CenterParent;
      this.ShowDialog ();
    }
 
    private void About_OK (Object source, EventArgs e)
    {
      Control wndCtrl = ((Button)source).Parent;
      ((Form)wndCtrl).Close ();
    }
    public static void Main(){
      new AboutBox();
    }
  }

Open in new window

Are you in Visual Studio?

If so, right click Project, AddNewItem > "Windows Forms" > "AboutBox"

This will create a "pre-created" about box that uses ur assemblies metadata to generate the information. It is real easy to modify if you have a need to.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.