-
Visual Studio C#에서 폴더 탐색창, 파일 탐색창 띄우기C#(asp.net | asp.net core) 2020. 10. 30. 15:05728x90
폴더 탐색창 띄우는 방법
1. Package Manager Console 창에서
Install-Package WindowsAPICodePack-Shell -Version 1.1.1 입력 후 Enter
2. 코드 입력
필요한 using 구문
using Microsoft.WindowsAPICodePack.Dialogs;
// 폴더 오픈창 생성 및 설정 CommonOpenFileDialg dl = new CommonOpenFileDialog(); dl.IsFolderPicker = true; dl.Multiselect = true; // 폴더 탐색기를 열어서 열기를 눌렀을 때 string[] pathDirs = null; if(dl.ShowDialog() == CommonFileDialogResult.Ok) { pathDir = dl.FileNames.ToArray(); } else { return; }
폴더 선택 창
파일 탐색창 띄우는 방법
// 파일 오픈창 생성 및 설정 OpenFileDialog dl = new OpenFileDialog(); // 다이얼로그 타이틀 설정 dl.Title = "파일 선택"; dl.Multiselect = true; // 파일 오픈창 로드 string[] pathFiles = null; if(dl.ShowDialog() == DialogResult.OK) { pathFiles = dl.FileNames.ToArray(); } else { return; }
파일 선택 창 728x90728x90'C#(asp.net | asp.net core)' 카테고리의 다른 글
C# state operation | record 사용법 (0) 2021.08.09 [C#] Web Form cs에서 javaScript 사용하기(alert) (0) 2021.07.13 [asp.net core] EntityFramwork Core Oracle 연동하기 (0) 2021.07.09 [asp.net / asp.net core] HttpException (0x80004005) : 최대 요청 길이를 초과했습니다 파일 업로드 에러 (0) 2021.07.07