private void QRdisplayForm_FormClosed(object sender, FormClosedEventArgs e) { ClassController classController = new ClassController(); try { Console.WriteLine("trying"); classController.InsertQRDisplayEndTime(Class.Id, DateTime.Now.ToString()); } catch (Exception ex) { MessageBox.Show(ex.Message); } }