Uredi

Deli z drugimi prek


Control.ProductName Property

Definition

Gets the product name of the assembly containing the control.

public:
 property System::String ^ ProductName { System::String ^ get(); };
[System.ComponentModel.Browsable(false)]
public string ProductName { get; }
[<System.ComponentModel.Browsable(false)>]
member this.ProductName : string
Public ReadOnly Property ProductName As String

Property Value

The product name of the assembly containing the control.

Attributes

Examples

The following code example displays information about the application in a Label contained by a Form. This example requires that the CompanyName, ProductName and ProductVersion have been set.

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 );
}
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;  
}
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

Remarks

The ProductName property is a read-only property. 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.

Applies to

See also