rvtmetaprop/FileSelector.cs
/// <summary>
/// Select a specified file in the given folder.
/// </summary>
/// <param name="folder">Initial folder.</param>
/// <param name="filename">Selected filename on 
/// success.</param>
/// <returns>Return true if a file was successfully 
/// selected.</returns>
Select a specified file in the given folder.
Select a specified file in the given folder .
static bool FileSelect(
      string folder,
      string title,
      string filter,
      ref string filename )
    {
      bool rc = false;
      using( OpenFileDialog dlg = new OpenFileDialog() )
      {
        dlg.Title = title;
        dlg.CheckFileExists = true;
        dlg.CheckPathExists = true;
        dlg.InitialDirectory = folder;
        dlg.FileName = filename;
        dlg.Filter = filter;
        rc = ( DialogResult.OK == dlg.ShowDialog() );
        filename = dlg.FileName;
      }
      return rc;
    }
static bool FileSelect ( string folder , string title , string filter , ref string filename ) { bool rc = false ; using ( OpenFileDialog dlg = new OpenFileDialog ( ) ) { dlg . Title = title ; dlg . CheckFileExists = true ; dlg . CheckPathExists = true ; dlg . InitialDirectory = folder ; dlg . FileName = filename ; dlg . Filter = filter ; rc = ( DialogResult . OK == dlg . ShowDialog ( ) ) ; filename = dlg . FileName ; } return rc ; }
Select a specified file in the given folder.
Select a specified file in the given folder .
Return true if a file was successfully
selected.
Return true if a file was successfully selected .
folder
string
None
title
string
filter
string
string
ref
filename
Selected filename on
success.
Selected filename on success .