Example #1
0
 private void AddClient_Click(object sender, EventArgs e)
 {
     try
     {
         long     Number    = long.Parse(PhoneNumberBox.Text);
         string   Full_Name = NameBox.Text;
         string   Address   = AddressBox.Text;
         string[] firstlast = Full_Name.Split(new char[] { ' ', '_', '-' }, StringSplitOptions.None);
         Clients.Add(new Client(firstlast[0], firstlast[1], Address, Number));
         MessageBox.Show("New Client Added!");
         NameBox.Clear();
         AddressBox.Clear();
         PhoneNumberBox.Clear();
         refreshClientBox();
         DisplayClients_Click(sender, e);
     }
     catch (FormatException)
     {
         MessageBox.Show("Please enter a valid phone number");
     }
     catch (IndexOutOfRangeException)
     {
         MessageBox.Show("Please enter a full name!");
     }
 }
        private void Button_Add(object sender, RoutedEventArgs e)
        {
            Contact Contact = new Contact();

            Contact.FirstName = FirstNameBox.Text;
            Contact.LastName  = LastNameBox.Text;
            Contact.Email     = EmailAddressBox.Text;
            Contact.Phone     = PhoneNumberBox.Text;
            Contacts.Add(Contact);
            FirstNameBox.Clear();
            LastNameBox.Clear();
            EmailAddressBox.Clear();
            PhoneNumberBox.Clear();
        }
Example #3
0
 private void Clear_form()
 {
     modify               = false;
     SaveButton.Enabled   = false;
     DeleteButton.Enabled = false;
     FirstNameBox.Clear();
     MiddleNmeBox.Clear();
     LastNameBox.Clear();
     GenderBox.Clear();
     Address1Box.Clear();
     Address2Box.Clear();
     CityBox.Clear();
     StateBox.Clear();
     ZipCodeBox.Clear();
     EmailBox.Clear();
     PhoneNumberBox.Clear();
     ResultList.SelectedItems.Clear();
     DateReceivedPicker.Value = DateTime.Today;
     StartTimeBox.Clear();
     SaveTimeBox.Clear();
     BackNumBox.Clear();
 }