• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 340
  • Last Modified:

How to show version number on a .NET windows form app

I know that the APP object that was available in VB6 is not supported in .NET but the assembly has a version attribute consiting of 4 parts and that the build number is automatically incremented with each build. I want to display all 4 numbers on a form caption (now called text) in a VB.NET Windows forms application. How do I access that info in the VB code or set the form's text property to that number?
  • 2
1 Solution
Fernando SotoRetiredCommented:
       Dim verMajor As String
        Dim verMinor As String
        Dim verBuild As String
        Dim verPrivate As String

        With System.Diagnostics.FileVersionInfo.GetVersionInfo( _
            verMajor = .FileMajorPart.ToString()
            verMinor = .FileMinorPart.ToString()
            verBuild = .FileBuildPart.ToString()
            verPrivate = .FilePrivatePart.ToString()
        End With

        Me.Text = "Version = " & verMajor & "." & verMinor & "." & _
            verBuild & "." & verPrivate

tomkovicAuthor Commented:
Great Answer. Can you point me to a reference that explains this so that I may better understand this?

I will just cut and paste the code for now but I want to understand the process better.

Thanks for the help.
Fernando SotoRetiredCommented:
Information about the file version number can be gotten from the documentation at MSDN web site at:


and the GetVersionInfo method will retrieve the parts of the version number for the specific file, in this case the executing assembly and is gotten by using the Reflection class.


and using the GetExecutingAssembly method.


If you are building your own software, you can set the version number in the AssembyInfo.vb file.

<Assembly: AssemblyVersion("1.00.00")>
<Assembly: AssemblyVersion("1.05.01")>
<Assembly: AssemblyVersion("5.00.00")>

you can reference your version number anytime in your code by using "Application.ProductVersion".  However, this is display ALL information including the


Fernando's example gives you some greater control over the display.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now