Bagikan melalui


Control.ProductVersion Properti

Definisi

Mendapatkan versi rakitan yang berisi kontrol.

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

Nilai Properti

Versi file rakitan yang berisi kontrol.

Atribut

Contoh

Contoh kode berikut menampilkan informasi tentang aplikasi dalam yang Label terkandung oleh Form. Contoh ini mengharuskan CompanyName, ProductName dan ProductVersion telah ditetapkan.

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

Keterangan

Properti ProductVersion adalah properti baca-saja. Untuk mengubah nilai properti ini, atur Version nilai properti dari AssemblyVersionAttribute. Baris kode C# berikut mengatur ProductVersion properti .

[assembly: AssemblyVersion("1.0.1")]

Nota

Sangat disarankan agar Anda memberikan nama perusahaan, nama produk, dan versi produk. Menyediakan informasi ini memungkinkan penggunaan fitur Windows Forms seperti Application.UserAppDataPath yang memudahkan penulisan aplikasi yang mematuhi program "Bersertifikat untuk Windows".

Berlaku untuk

Lihat juga