Basic C-sharp

Contents:
C1. Event handler for form closing (button X)

C1. Event handler for form closing (button X)
SO1 , SO2

tried & works

this.FormClosing += this.fDAQ_FormClosing;

or

this.Load += new System.Windows.Forms.FormClosingEventHandler(fDAQ_FormClosing)

then

private void fDAQ_FormClosing(object sender, EventArgs e)

not tried yet

if (string.Equals((sender as Button).Name, @"CloseButton"))
// something
else
// Then assume that X has been clicked and act accordingly.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s