//Exit and save private void btnExit_Click(object sender, EventArgs e) { try { ClsCompany.Save(); } catch (Exception ex) { MessageBox.Show(ex.GetBaseException().Message); } Close(); }
//Initialize form and load saved data public FrmMain() { InitializeComponent(); cboSortBy.DataSource = _SortByList; cboSortBy.SelectedIndex = 0; //retrive saved stuff try { ClsCompany.Retrieve(); } catch (Exception ex) { MessageBox.Show(ex.GetBaseException().Message); } }
//sends data to new Tour object and saves the tour private void btnOK_Click(object sender, EventArgs e) { //check if tour code exists if (txtTourCode.Enabled && ClsCompany.TourList.ContainsKey(txtTourCode.Text)) { MessageBox.Show("A Tour with that Code already exists", "Duplicate Code"); } else { pushData(); DialogResult = DialogResult.OK;//returns result of 1 or true //save try { ClsCompany.Save(); } catch (Exception ex) { MessageBox.Show(ex.GetBaseException().Message); } } }
//submit and save cost private void btnSubmit_Click(object sender, EventArgs e) { ClsCompany.Save(); Close(); }