//Called when the log form is closed void log_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e) { //Remove the log handler; it'll cause problems otherwise.. log.FormClosing -= log_FormClosing; //Null the reference log = null; }
//Called by the backend in response to a log request public void UpdateLogRecord(DataTable record) { //Make sure a log book doesn't exist first... if (log == null) { log = new WATR_Logbook(); //Add an event handler for the log log.FormClosing += log_FormClosing; log.Text += " - " + this.Identifier; log.SetDataSource(record); log.Show(); } }