gFinger 손끝으로 만드는 세상


File Name을 선택해서 Text 파일 읽기


            OpenFileDialog dlg = new OpenFileDialog();
            dlg.Title = "Open License File";
            dlg.Filter = "License File (*.lic)|*.lic";
            dlg.FileName = Application.StartupPath + "\\..\\..\\" + filename;

            string ActivationKey;
            if (dlg.ShowDialog() != DialogResult.OK) return false;
            try
            {
                System.IO.StreamReader ObjReader = new System.IO.StreamReader(dlg.FileName);
                ActivationKey = ObjReader.ReadLine();
                ObjReader.Close();
            }
            catch (Exception ex) //General exception
            {
                MessageBox.Show(ex.Message);
                return false;
            } 


'컴퓨터 이야기 > c#' 카테고리의 다른 글

visual studio 빌드 후 이벤트  (0) 2018.11.29
Text File Save Dialog  (0) 2018.06.09
How to move and resize a form without a border?  (0) 2018.06.09
Form을 Drag해서 이동  (0) 2018.06.09
Program 2번 실행 방지  (0) 2018.06.06