gFinger 손끝으로 만드는 세상


Text File Save Dialog


       SaveFileDialog dlg = new SaveFileDialog();
            dlg.Title = "Save License File";
            dlg.Filter = "lic Files (*.lic)|*.lic";
            dlg.FileName = Application.StartupPath + "\\..\\..\\ssPlcADS.lic";
            if (dlg.ShowDialog() != DialogResult.OK) return;
            try
            {
                var sr = new System.IO.StreamWriter(dlg.FileName, false, System.Text.Encoding.UTF8);
                //Write the header
                sr.WriteLine(textBoxKey.Text);
                sr.Close();
            }
            catch
            {
                MessageBox.Show("Can't Write Key File");
            }