백엔드/C#
파일 경로 찾기 - OpenFileDialog
1005ptr
2018. 5. 13. 03:14
반응형
로컬에 있는 파일경로 읽어오기
링크 : OpenFileDialog
private string ShowFileOpenDialog()
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Title = "엑셀파일 선택";
ofd.FileName = "";
ofd.Filter = "엑셀 파일 (*.xlsx, *.xls, *.xltx, *.xlt) | *.xlsx; *.xls; *.xltx; *.xlt;";
DialogResult dr = ofd.ShowDialog();
if (dr == DialogResult.OK)
return ofd.FileName;
else if (dr == DialogResult.Cancel)
return "";
return "";
}
1. Title : 파일선택창 타이틀
2. Filter : 엑셀 파일 (*.xlsx, *.xls, *.xltx, *.xlt) | *.xlsx; *.xls; *.xltx; *.xlt;
- 화면에 나오는 부분 : 엑셀 파일 (*.xlsx, *.xls, *.xltx, *.xlt)
- 필터할 확장자 : *.xlsx; *.xls; *.xltx; *.xlt;
반응형