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