How to close a messageBox soon after user response on a windows form
Posted on 2007-10-10
I have a windows parent form, on which I open a MessageBox.
I need to close the MessageBox soon after user responds to the Yes or No buitton
The issue is when the user clicks No, the messagebox closes fine, but when the user clicks Yes, the MessageBox remains open until the method transferRecord() does its processing.
I need to close the MessageBox, soon after the user clicks Yes and then do the transferRecord() processing
here is my code
private void transferPB_Click(object sender, EventArgs e)
foreach( conditon xyz)
DialogResult result = MessageBox.Show(this,"Do you want to transfer records with errors?","Data Transfer",MessageBoxButtons.YesNo,MessageBoxIcon.Question,MessageBoxDefaultButton.Button1);
if(result == DialogResult.Yes)
//The user clicked the NO button.