Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

About Using the form Deactivate Event ?

$
0
0

Hi everyone,

I am trying to use the deactive event of a form. Please see my below example 

private void frmMain_Deactivate(object sender, EventArgs e) { try { ..... if (blnSaveData == false) {

Result = MessageBox.Show ("You haven't saved data yet !", "", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

if (Result == DialogResult.Yes)

{ ....}

} } catch (Exception ex) { MessageBox.Show(ex.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }

When running to the statement MessageBox.Show, it call back the event again many times. But, I don't want to this happen, I only want to show the message and execute remain lines then exit the event.

Are there anyone know how can I do that ?

Thanks and regards,

Tai


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>