FileDialog.InitialFileName Property
Returns or sets a String representing the path and/or file name that is initially displayed in a file dialog box.
Namespace: Microsoft.Office.Core
Assembly: office (in office.dll)
Syntax
'Declaration
Property InitialFileName As String
Get
Set
'Usage
Dim instance As FileDialog
Dim value As String
value = instance.InitialFileName
instance.InitialFileName = value
string InitialFileName { get; set; }
Property Value
Type: System.String
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.