This documentation is archived and is not being maintained.

FileVersionInfo.ToString Method

Returns a partial list of properties in the FileVersionInfo and their values.

[Visual Basic]
Overrides Public Function ToString() As String
[C#]
public override string ToString();
[C++]
public: String* ToString();
[JScript]
public override function ToString() : String;

Return Value

A list of the following properties in this class and their values:

FileName, InternalName, OriginalFilename, FileVersion, FileDescription, ProductName, ProductVersion, IsDebug, IsPatched, IsPreRelease, IsPrivateBuild, IsSpecialBuild.

If no file with the specified name is found, this list will contain only the name of the requested file. Boolean values will be false, and all other entries will be a null reference (Nothing in Visual Basic).

Example

[Visual Basic, C#, C++] The following example calls GetVersionInfo to get the FileVersionInfo for the Notepad. Then it calls ToString to print a list of the file version information in a text box. This code assumes textBox1 has been instantiated.

[Visual Basic] 
Private Sub GetFileVersion2()
    ' Get the file version for the notepad.
    Dim myFileVersionInfo As FileVersionInfo = _
        FileVersionInfo.GetVersionInfo("%systemroot%\Notepad.exe")
    
    ' Print all the version information.
    textBox1.Text = myFileVersionInfo.ToString()
End Sub 'GetFileVersion2

[C#] 
private void GetFileVersion2() {
    // Get the file version for the notepad.
    FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo("%systemroot%\\Notepad.exe");
 
    // Print all the version information.
    textBox1.Text = myFileVersionInfo.ToString();
 }


[C++] 
private:
void GetFileVersion2() {
    // Get the file version for the notepad.
    FileVersionInfo* myFileVersionInfo = FileVersionInfo::GetVersionInfo(S"%systemroot%\\Notepad.exe");
 
    // Print all the version information.
    textBox1->Text = myFileVersionInfo->ToString();
 }

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

FileVersionInfo Class | FileVersionInfo Members | System.Diagnostics Namespace | FileName | InternalName | OriginalFilename | FileVersion | FileDescription | Language | ProductName | ProductVersion | IsDebug | IsPatched | IsPreRelease | IsPrivateBuild | IsSpecialBuild

Show: