Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

Control.ProductName Property

Gets the product name of the assembly containing the control.

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

Property Value

The product name of the assembly containing the control.

Remarks

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

[assembly: AssemblyProduct("MyApplication")]
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 | AssemblyProductAttribute.Product

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.