FileDialog.InitialFileName Property

Definition

Returns or sets a String representing the path and/or file name that is initially displayed in a file dialog box.

public:
 property System::String ^ InitialFileName { System::String ^ get(); void set(System::String ^ value); };
public string InitialFileName { get; set; }
member this.InitialFileName : string with get, set
Public Property InitialFileName As String

Property Value

Remarks

You can use the '*' and '?' wildcard characters when specifying the file name but not when specifying the path. The '*' represents any number of consecutive characters, and the '?' represents a single character. For example, .InitialFileName = "c:\c*s.txt" will return both "charts.txt" and "checkregister.txt."

If you specify a path and no file name, then all files that are allowed by the file filter will appear in the dialog box.

If you specify a file that exists in the initial folder, then only that file will appear in the dialog box.

If you specify a file name that doesn't exist in the initial folder, then the dialog box will contain no files. The type of file that you specify in the InitialFileName property will override the file filter settings.

If you specify an invalid path, the last-used path is used. A message will warn users when an invalid path is used.

Setting this property to a string longer than 256 characters will cause a run-time error.

Applies to