Click here to Skip to main content
Click here to Skip to main content

About... The About Box

By , 4 Mar 2007
 

Sample Image - aboutbox.gif

Introduction

The About Box dialog isn't an essential part of any application, but it serves an important role, as the "dogtags" for your application.

There are two distinct, and very different, audiences for this dialog.

  • users: to identify the application's name, who made it, when it was created, and what version they have. Very basic stuff.
  • developers: to provide extremely detailed build, version, and file information. Typically used when troubleshooting problems with compiled, deployed code.

You definitely should have an About Box-- but to continue with the dogtag analogy, if you're whipping out dogtags on a regular basis, that's symptomatic of a deeper problem (Mediiiic!). When you do need it, it can be a lifesaver. It's OK to be used infrequently, but it also needs to provide decent diagnostic info. Decorative About Boxes with their scrolling text and 3D graphics may be fun, but they aren't helpful.

In order to serve the needs of these two vastly different user groups, my About Box provides two views: a simple, basic view for users, and a vastly more detailed view (accessible through a "More >>" button) for developers.

Using the code

This form is intended to be a standalone, resuable component; simply drag and drop the AboutBox.vb file into your project, then instantiate it as you would any other form. It has no special dependencies.

Private Sub MenuItemAbout_Click(ByVal sender As System.Object,_
                   ByVal e As System.EventArgs) Handles MenuItemAbout.Click
   Dim frmAbout As New AboutBox
   frmAbout.ShowDialog(Me)
End Sub

That provides the simplest, default About Box behavior. This should work for most applications right out of the box (as pictured in the screenshot). If you want to customize the form's behavior, it does have a number of optional properties that can be set before showing the dialog:

Public Property AppEntryAssembly() As System.Reflection.Assembly
Public Property AppTitle() As String
Public Property AppDescription() As String
Public Property AppVersion() As String
Public Property AppCopyright() As String
Public Property AppImage() As Image
Public Property AppMoreInfo() As String
Public Property AppDetailsButton() As Boolean

The sample application demonstrates how to set these properties to customize the text in the dialog.

Points of Interest

The primary information presented by the About Box form is automatically derived from the AssemblyInfo.* file. The AssemblyInfo.* file should always be populated for all of your assemblies as a best programming practice, but you'll want to make doubly sure in this case.

<Assembly: AssemblyTitle("About Box Demo")>
<Assembly: AssemblyDescription("Demonstration of AboutBox.vb code")>
<Assembly: AssemblyCompany("Atwood Heavy Industries")>
<Assembly: AssemblyProduct("Demo code")>
<Assembly: AssemblyCopyright("© 2004, Atwood Heavy Industries")>
<Assembly: AssemblyTrademark("All Rights Reserved")>

The rest of the detailed information is gathered through .NET's built in, and very powerful, reflection capabilities.

The build date is automatically calculated for each assembly based on the Build and Revision numbers specified in the AssemblyInfo.*:

<Assembly: AssemblyVersion("4.1.*")>

This algorithm only works if standard auto-increment values were used (as pictured):

dt = CType("01/01/2000", DateTime). _
  AddDays(AssemblyVersion.Build). _
  AddSeconds(AssemblyVersion.Revision * 2)
If TimeZone.IsDaylightSavingTime(dt, _
  TimeZone.CurrentTimeZone.GetDaylightChanges(dt.Year)) Then
  dt = dt.AddHours(1)
End If
If dt > DateTime.Now Or AssemblyVersion.Build < 730 Or _
  AssemblyVersion.Revision = 0 Then
  dt = AssemblyLastWriteTime(a)
End If

If you've overridden the Build or Revision numbers, I can't calculate build date that way. In those scenarios, I use GetLastWriteTime on the assembly DLL file. I'm not aware of any more accurate methods to get build date, but between these two, the build time is usually correct.

History

  • Monday, June 14, 2004 - Published.
  • Sunday, December 19, 2004 - Version 1.1
    • code refactored for readability and simplicity.
    • switched to RichTextBox for more text, so URLs and MAILTO are automatically supported in .AppMoreInfo property.
    • More assembly properties are enumerated in the Assembly Detail tab.
    • converted to VB.NET 2005 style XML comments.
    • now with 36% more cowbell!
  • Wednesday, Janary 30, 2007 - Version 1.2
    • Added support for using proper system font
    • Tested in Windows Vista
    • Ported to Visual Studio 2005 and .NET 2.0
  • Monday, February 26, 2007 - Version 1.2a
    • Added C# version, thanks to Scott Ferguson!

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

About the Author

wumpus1
Web Developer
United States United States
Member
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.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionWhat happened to the .zip files??memberMember 809388322 Jan '13 - 10:01 
QuestionGreat! Thanks!membercatchit20008 Mar '12 - 12:43 
GeneralMy vote of 5memberDuffmanLight3 Oct '11 - 13:40 
Generalthank youmemberserjik_avr8 Nov '09 - 22:18 
Generalgood articlememberDonsw15 Mar '09 - 16:26 
QuestionPlace holders are visible [modified]memberJiong Mai22 Sep '08 - 3:27 
AnswerRe: Place holders are visiblememberJiong Mai1 Dec '08 - 4:38 
GeneralRe: Place holders are visiblememberubik14 Jan '09 - 20:24 
QuestionCan we have a WPF Version ?memberubik4 Aug '08 - 1:19 
AnswerRe: Can we have a WPF Version ?memberandrew.nagel@dot.gov26 Nov '10 - 4:04 
QuestionExcellent Work! Details button disappears after the 1st time.memberWarrenG22 May '08 - 13:18 
AnswerRe: Excellent Work! Details button disappears after the 1st time.memberkenboo27 Feb '12 - 8:30 
GeneralWell done.memberDaniel Landers27 Mar '08 - 2:53 
GeneralhelpfulmemberAbhijit Jana15 Jan '08 - 3:51 
GeneralProblem when using with XslCompiledTransformmemberMattman2068 Aug '07 - 4:22 
GeneraladditionsmemberMr.Mullet2 Jul '07 - 1:03 
GeneralHelp withmemberbgc-waterman28 Feb '07 - 8:18 
GeneralConversion to c#membermejax24 Jan '07 - 9:26 
GeneralRe: Conversion to c#memberRobert M. Bouwens31 Jan '07 - 2:52 
GeneralRe: Conversion to c#membermejax31 Jan '07 - 6:01 
AnswerRe: Conversion to c#memberwumpus126 Feb '07 - 10:26 
GeneralRe: Conversion to c#membermejax26 Feb '07 - 23:13 
GeneralRe: Conversion to c#memberwumpus15 Mar '07 - 9:58 
GeneralRe: Conversion to c#membermejax5 Mar '07 - 23:50 
GeneralRe: Conversion to c#memberjcooper98723 Jul '08 - 11:10 
GeneralThanks for the code---membermef5268 Feb '06 - 7:59 
GeneralThanks!memberFenra6 Dec '05 - 8:26 
GeneralNice OnememberSk8tz5 Apr '05 - 20:05 
QuestionWeb Application ?membermejax3 Jan '05 - 21:13 
AnswerRe: Web Application ?memberwumpus19 Feb '05 - 14:11 
GeneralRe: Web Application ?membermejax9 Feb '05 - 22:27 
GeneralAWSOME JOB!!!memberBadger08128 Aug '04 - 16:56 
GeneralDisplaying custom informationmemberMichaelWells5 Jul '04 - 18:20 
GeneralRe: Displaying custom informationmemberwumpus15 Jul '04 - 20:30 
GeneralButtons at title barmemberw1424317 Jun '04 - 15:40 
GeneralRe: Buttons at title barmemberwumpus120 Jun '04 - 19:05 
GeneralRe: Buttons at title barmemberShay Ben-Sasson25 Dec '04 - 1:22 
GeneralUndersoldmemberJoel Holdsworth14 Jun '04 - 1:52 
GeneralRe: Undersoldmemberwumpus115 Jun '04 - 13:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 4 Mar 2007
Article Copyright 2004 by wumpus1
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid