This documentation is archived and is not being maintained.

Control.ProductVersion Property

Gets the version of the assembly containing the control.

[Visual Basic]
Public ReadOnly Property ProductVersion As String
[C#]
public string ProductVersion {get;}
[C++]
public: __property String* get_ProductVersion();
[JScript]
public function get ProductVersion() : String;

Property Value

The file version of the assembly containing the control.

Remarks

The ProductVersion property is a read-only property. In order to change the value of this property, set the Version property value of the AssemblyVersionAttribute. The following line of C# code sets the ProductVersion property.

[assembly: AssemblyVersion("1.0.1")]
Note   It is strongly recommended that you provide the company name, product name, and product version. Providing this information enables the use of Windows Forms features such as Application.UserAppDataPath that make it easier to write applications that comply with the "Certified for Windows" program. For more information on the Certified for Windows program, see http://msdn.microsoft.com/certification.

Example

[Visual Basic, C#, C++] The following example displays information about the application in a Label contained by a Form. This code assumes the CompanyName, ProductName and ProductVersion have been set.

[Visual Basic] 
Private Sub AboutDialog_Load(sender As Object, e As EventArgs) Handles MyBase.Load
   ' Display the application information in the label.
   Me.labelVersionInfo.Text = _
      Me.CompanyName + "  " + _
      Me.ProductName + "  Version: " + _
      Me.ProductVersion
   End Sub

[C#] 
private void AboutDialog_Load(object sender, EventArgs e)
{
   // Display the application information in the label.
   this.labelVersionInfo.Text = 
      this.CompanyName + "  " + 
      this.ProductName + "  Version: " +
      this.ProductVersion;  
}

[C++] 
void AboutDialog_Load(Object* /*sender*/, EventArgs* /*e*/) {
   // Display the application information in the label.
   this->labelVersionInfo->Text =
      String::Format( "{0} {1} Version: {2}", this->CompanyName, this->ProductName, this->ProductVersion );
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Control Class | Control Members | System.Windows.Forms Namespace | AssemblyVersionAttribute.Version

Show: