Example #1
0
 private void c_EditBtn_Click(object sender, EventArgs e)
 {
     CCustomer tmpCustomer = c_CustomersList.SelectedItem as CCustomer;
     customerForm newForm = new customerForm();
     newForm.Text = "Editing " + tmpCustomer.name + " " + tmpCustomer.lastName;
     newForm.customer = tmpCustomer;
     newForm.edit = true;
     if (newForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         c_CustomersList.Items[c_CustomersList.SelectedIndex] = newForm.customer;
         c_CustomersList.SelectedItem = newForm.customer;
     }
 }
Example #2
0
 private void c_AddBtn_Click(object sender, EventArgs e)
 {
     customerForm newForm = new customerForm();
     newForm.Text = "Add New Customer";
     newForm.edit = false;
     if (newForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         c_CustomersList.Items.Add(newForm.customer);
         c_EditBtn.Enabled = true;
         c_DeleteBtn.Enabled = true;
         c_CustomersList.SelectedIndex = c_CustomersList.Items.Count - 1;
     }
 }