Hi guys I have a msg field, when I click yes, it closes the form that calls msg box how can I do it when msg box dialogresult = ok close only myself
Set the property to the DialogResaultvalue Nonefor the button that the event handler opens the MessageBox.
DialogResault
None
Good luck
DialogResult result = MessageBox.Show("Click yes to close, otherwise click no.", "Message Box Test", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { Application.Exit(); }
, DialogResult (. http://msdn.microsoft.com/en-us/library/system.windows.forms.form.dialogresult.aspx) , , :
DialogResult
" , DialogResult , ."
:
if (MessageBox.Show(...) == DialogResult.Yes) { } else { }