Control.ProductName Propriété
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Obtient de nom de produit de l'assembly contenant le contrôle.
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
Nom de produit de l'assembly contenant le contrôle.
- Attributs
L’exemple de code suivant affiche des informations sur l’application dans un Label contenu par un Form. Cet exemple nécessite que le CompanyNameparamètre , ProductName et ProductVersion qu’il ait été défini.
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
La ProductName propriété est une propriété en lecture seule. Pour modifier la valeur de cette propriété, définissez la Product valeur de la propriété .AssemblyProductAttribute La ligne de code C# suivante définit la ProductName propriété.
[assembly: AssemblyProduct("MyApplication")]
Note
Il est vivement recommandé de fournir le nom de l’entreprise, le nom du produit et la version du produit. La fourniture de ces informations permet d’utiliser Windows Forms fonctionnalités telles que Application.UserAppDataPath celles qui facilitent l’écriture d’applications conformes au programme « Certifié pour Windows ».
Produit | Versions |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8 |
Windows Desktop | 3.0, 3.1, 5, 6, 7 |