본문 바로가기

C#

[C#] How to: Use the Open File Dialog Box

https://msdn.microsoft.com/en-us/library/cc221415(v=vs.95).aspx


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Create an instance of the open file dialog box.
Microsoft.Win32.OpenFileDialog openFileDialog1 = new Microsoft.Win32.OpenFileDialog();
 
// Set filter options and filter index.
openFileDialog1.Filter = "Text Files (.txt)|*.txt|All Files (*.*)|*.*";
openFileDialog1.FilterIndex = 1;
 
// Call the ShowDialog method to show the dialog box.
bool? userClickedOK = openFileDialog1.ShowDialog();
 
// Process input if the user clicked OK.
if (userClickedOK == true)
{
    // Do some
    openFileDialog1.FileName;
}
cs


'C#' 카테고리의 다른 글

[C#] Download Files from Web  (0) 2016.08.03
[c#] $#???; 형태의 유니코드를 한글로 변환  (0) 2016.08.02
[C#] Json Read&Write  (0) 2016.07.01