shows browsing for a file : Open File Dialog « GUI Windows Form « C# / C Sharp






shows browsing for a file

shows browsing for a file
/*
Mastering Visual C# .NET
by Jason Price, Mike Gunderloy

Publisher: Sybex;
ISBN: 0782129110
*/

 /*
  Example15_1.cs shows browsing for a file
*/

using System;
using System.Windows.Forms;

public class Example15_1 {
  
  [STAThread]
  public static void Main() {

    // create and show an open file dialog
  OpenFileDialog dlgOpen = new OpenFileDialog();
  if (dlgOpen.ShowDialog() == DialogResult.OK)
    {
    Console.Write(dlgOpen.FileName);
    }

  }

}


           
       








Related examples in the same category

1.Call ShowDialog() to display an OpenFileDialog
2.Set InitialDirectory
3.Set CheckFileExists to true
4.Set Filter
5.FileOk Action
6.shows browsing for a set of filesshows browsing for a set of files
7.Open File Dialog with file typesOpen File Dialog with file types
8.Demonstrates using an OpenFileDialog to prompt for a file name, and to open a fileDemonstrates using an OpenFileDialog to prompt for a file name, and to open a file
9.Show the use of some of the OpenFile dialog boxShow the use of some of the OpenFile dialog box