Control.ProductVersion プロパティ

定義

コントロールを格納しているアセンブリのバージョンを取得します。

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

プロパティ値

String

コントロールを格納しているアセンブリのファイル バージョン。

属性

次のコード例では、アプリケーションに関する情報を表示します。Label Form この例では、設定済みCompanyNameProductNameである必要があります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

注釈

ProductVersion プロパティは、読み取り専用のプロパティです。 このプロパティの値を変更するには、VersionAssemblyVersionAttribute. 次の C# コード行は、プロパティを設定します ProductVersion

[assembly: AssemblyVersion("1.0.1")]  

注意

会社名、製品名、および製品バージョンを指定することを強くお勧めします。 この情報を提供することで、"Windows 認定プログラム" プログラムに準拠したアプリケーションを簡単に作成できるようにするなどのApplication.UserAppDataPathWindows フォーム機能を使用できます。

適用対象

こちらもご覧ください