Beispiel #1
0
        //function to add new car information
        public void btnAddCar_Click(object sender, System.EventArgs e)
        {
            FrmCarDetail formCarDetail = new FrmCarDetail();

            if (formCarDetail.ShowDialog(this) == DialogResult.OK)
            {
                Cars.Add(formCarDetail.GetResult());
                PopulateListView();
            }
        }
Beispiel #2
0
 //function to edit car information
 public void btnEditCar_Click(object sender, System.EventArgs e)
 {
     if (listViewCar.SelectedItems.Count == 0)
     {
         MessageBox.Show("Please select car data that want to be edited");
     }
     else
     {
         FrmCarDetail formCarDetail = new FrmCarDetail(Cars[listViewCar.SelectedItems[0].Index]);
         if (formCarDetail.ShowDialog(this) == DialogResult.OK)
         {
             Cars[listViewCar.SelectedItems[0].Index] = formCarDetail.GetResult();
             PopulateListView();
         }
     }
 }