private void FrmMain_FormClosing(object sender, FormClosingEventArgs e) { try { ClsCompany.Save(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Something went wrong while saving"); } }
public FrmMain() { InitializeComponent(); try { ClsCompany.Retrieve(); } catch (Exception ex) { MessageBox.Show(ex.Message); } UpdateDisplay(); }
private void UpdateDisplay() { lstVehicle.DataSource = ClsCompany.VehicleList.Values.ToList(); lstVehicle.DisplayMember = "RegistrationNumber"; lblValue.Text = string.Format("{0:C} ", ClsCompany.TotalValue()); }