I want my form submit when I click MessageBoxButton OK and if I click Cancel button my form not be submitted and when my form submit, text box radio button and other control will initialize and text box will be blank. Please help to right code.
such as
private void btnSubmit_Click(object sender, EventArgs e)
{
MessageBox.Show("Prese ok for submit data....","Information ! Check Data and pres ok for submited other wise pres cancel button for Cancellation......... ",MessageBoxButtonOKCancel, MessageBoxButtonIcon.Information);
//and then..........what we write
}
How to add code for MesageBoxButton
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Satyapriya NayakRank #47 · 31.5K reputationPosted May 5, 2012, 7:29 PM EDT
private void button1_Click(object sender, EventArgs e)
{
DialogResult myDialogResult;
myDialogResult = MessageBox.Show("OK", "Cancel", MessageBoxButtons.OKCancel);
if (myDialogResult == DialogResult.OK)
{
MessageBox.Show("You clicked ok");
}
if (myDialogResult == DialogResult.Cancel)
{
MessageBox.Show("You clicked cancel");
}
}
Thanks