Partager via


Control.ProductName Propriété

Définition

Obtient le nom du 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

Valeur de propriété

Nom du produit de l’assembly contenant le contrôle.

Attributs

Exemples

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

Remarques

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 fortement recommandé de fournir le nom de la société, le nom du produit et la version du produit. La fourniture de ces informations permet d’utiliser des fonctionnalités Windows Forms telles que Application.UserAppDataPath celles qui facilitent l’écriture d’applications conformes au programme « Certified for Windows ».

S’applique à

Voir aussi