[C#] 파일 불러오기, 파일 열기 (다이얼로그) - OpenFileDialog 객체


[C#] 파일 불러오기, 파일 열기 (다이얼로그) - OpenFileDialog 객체

OpenFileDialog C#에서 파일을 첨부해야할 필요가 있는 경우, 로컬경로에서 첨부해야할 파일의 이름과 경로를 가지고 와야합니다. C#에서는 친절하게도 윈도우기반답게 OpenFileDialog 객체를 통해 너무나도 익숙한 다이얼로그창을 호출할 수 있습니다. OpenFileDialog ofd = new OpenFileDialog(); ofd.InitialDirectory = "C:\\"; string sFileName = string.Empty; string sFileFullName = string.Empty; if (ofd.ShowDialog() == DialogResult.OK) { sFileName = ofd.SafeFileName; sFileFullName = ofd.FileName; } OpenFileDialog 객체를 선언한 후 속성값 InitialDirectory 의 값은 "C:\\" 으로 지정하였습니다. 해당 속성값은 파일 열기 다이얼로그가 호출되었을 때, 가장 ...


#C언어 #OpenFileDialog #프로그래밍

원문링크 : [C#] 파일 불러오기, 파일 열기 (다이얼로그) - OpenFileDialog 객체