After retriving the data from database, When I click the Update button there will raise a messagebox as “Changes has done.Do u like to proceed” with Yes/No buttons. But i want to raise the message box when I made any changes only. If i didn’t make any changes it should not raise.. Please help me how to know the changes in my textboxes and comboxes.
My code for raising is
DialogResult result = MessageBox.Show("Chanes has done, Do you wish to save changes.?", "Message",MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
// HERE MY UPDATE CODE.
}
You’ll need to store the original values as strings, then compare these to the resulting values.
Alternatively a simpler implementation could just set a boolean
isDirtyflag to true on the text box changed event, and reset to false on a successful update.Example code to help highlight what’s needed included below:
.
.