반응형
private void textSave() // txtNote 컨트롤에 입력된 데이터를 저장하는 작업
{
if(this.Text == "제목 없음") //제목없음이면 저장되지않은 초기상태로 판단하여 새로 저장을 한다.
{
var dlr = this.sfdFile.ShowDialog();
if(dlr != DialogResult.Cancel)
{
var str = this.sfdFile.FileName;
var sw = new StreamWriter(str, false,
System.Text.Encoding.Default);
sw.Write(this.txtNote.Text);
sw.Flush();
sw.Close();
this.Text = str;
this.txtNoteChange = false;
}
}
}//End textSave
sfdFile = SaveFileDialog 컨트롤
txtNote = textbox 컨트롤
반응형
'언어 > C#' 카테고리의 다른 글
[C#] MS-SQL 데이터 연동 해서 DataSet에 저장하는 방법 (0) | 2020.02.27 |
---|---|
[C#] 유효성검사 System.Text.RegularExpressions.Regex.IsMatch 사용 (0) | 2020.02.27 |
[Windows Forms] 윈폼 버튼 클릭이벤트 메시지박스 출력하기 (0) | 2020.01.22 |