Click here to Skip to main content
15,898,035 members
Articles / Programming Languages / Visual Basic

About... The About Box

Rate me:
Please Sign up or sign in to vote.
4.70/5 (98 votes)
4 Mar 20073 min read 308.3K   4.4K   200  
A reusable About Box form for developers and users.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace AboutBoxDemo
{
    /// <summary>
    /// Generic About Box Dialog demo form
    /// </summary>
    /// <remarks>
    /// Jeff Atwood
    /// http://www.codinghorror.com
    /// </remarks>
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void ShowAbout()
        {
            AboutBox ab = new AboutBox();
            ab.AppTitle = txtTitle.Text;
            ab.AppDescription = txtDescription.Text;
            ab.AppVersion = txtVersion.Text;
            ab.AppCopyright = txtCopyright.Text;
            ab.AppMoreInfo = txtMoreInfo.Text;
            ab.AppDetailsButton = chkDetails.Checked;
            ab.ShowDialog(this);
        }

        private void Button1_Click(object sender, EventArgs e)
        {
            ShowAbout();
        }

        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ShowAbout();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            AboutBox ab = new AboutBox();
            txtTitle.Text = ab.AppTitle;
            txtDescription.Text = ab.AppDescription;
            txtVersion.Text = ab.AppVersion;
            txtCopyright.Text = ab.AppCopyright;
            txtMoreInfo.Text = ab.AppMoreInfo;

            txtMoreInfo.Text += Environment.NewLine;
            txtMoreInfo.Text += Environment.NewLine;
            txtMoreInfo.Text += "http://www.codinghorror.com/blog/" + Environment.NewLine;
            txtMoreInfo.Text += "mailto:jatwood@codinghorror.com?subject=your+code+stinks" + Environment.NewLine;

        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
My name is Jeff Atwood. I live in Berkeley, CA with my wife, two cats, and far more computers than I care to mention. My first computer was the Texas Instruments TI-99/4a. I've been a Microsoft Windows developer since 1992; primarily in VB. I am particularly interested in best practices and human factors in software development, as represented in my recommended developer reading list. I also have a coding and human factors related blog at www.codinghorror.com.

Comments and Discussions