Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 KB | None | 0 0
  1. using System;
  2. using System.Windows.Forms;
  3.  
  4. namespace ConsoleApplication2
  5. {
  6.     internal class Program
  7.     {
  8.         public static void Main(string[] args)
  9.         {
  10.             using (var openFileDialog = new OpenFileDialog())
  11.             {
  12.                 openFileDialog.InitialDirectory = "c:\\";
  13.                 openFileDialog.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
  14.                 openFileDialog.FilterIndex = 2;
  15.                 openFileDialog.RestoreDirectory = true;
  16.  
  17.                 if (openFileDialog.ShowDialog() == DialogResult.OK)
  18.                 {
  19.                    Console.WriteLine(openFileDialog.FileName);
  20.                 }
  21.             }
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement