Condividi tramite


Control.ProductVersion Proprietà

Definizione

Ottiene la versione dell'assembly contenente il controllo .

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

Valore della proprietà

Versione del file dell'assembly contenente il controllo .

Attributi

Esempio

Nell'esempio di codice seguente vengono visualizzate informazioni sull'applicazione in un Label oggetto contenuto in un oggetto Form. In questo esempio è necessario che sia CompanyNameProductName stato impostato e ProductVersion .

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

Commenti

La ProductVersion proprietà è una proprietà di sola lettura. Per modificare il valore di questa proprietà, impostare il Version valore della proprietà di AssemblyVersionAttribute. La riga di codice C# seguente imposta la ProductVersion proprietà .

[assembly: AssemblyVersion("1.0.1")]

Annotazioni

È consigliabile specificare il nome della società, il nome del prodotto e la versione del prodotto. Fornire queste informazioni consente l'uso di funzionalità di Windows Form, Application.UserAppDataPath ad esempio che semplificano la scrittura di applicazioni conformi al programma "Certified for Windows".

Si applica a

Vedi anche