C#

Confirm Massage 창 띄우기

by kay posted Jul 22, 2013
?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

크게 작게 위로 아래로 댓글로 가기 인쇄

Confirm Massage 창 띄우기 

msdn Url : http://msdn.microsoft.com/ko-kr/library/system.windows.forms.messagebox.aspx


private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
    const string message =
        "Are you sure that you would like to close the form?";
    const string caption = "Form Closing";
    var result = MessageBox.Show(message, caption,
                                 MessageBoxButtons.YesNo,
                                 MessageBoxIcon.Question);

    // If the no button was pressed ...
    if (result == DialogResult.No)
    {
        // cancel the closure of the form.
        e.Cancel = true;
    }
}