private int AddCustomer() { try { string errMsg = String.Empty; if (IsNumeric(txtCustomersFirstName.Text) || IsNumeric(txtCustomersLastName.Text)) { errMsg = " first name or last name can not contain numbers" + Environment.NewLine; } if (txtCustomersFirstName.TextLength == 0) { errMsg += "Incorrect first name" + Environment.NewLine; } if (txtCustomersLastName.TextLength == 0) { errMsg += "Incorrect last name" + Environment.NewLine; } if (txtCustomersFirstName.TextLength == 0 || txtCustomersLastName.TextLength == 0 || IsNumeric(txtCustomersFirstName.Text) || IsNumeric(txtCustomersLastName.Text)) { MessageBox.Show(errMsg); return(-1); } var customer = new Customer() { FirstName = txtCustomersFirstName.Text, LastName = txtCustomersLastName.Text }; booking.AddCustomer(customer); FillCustomers(); txtCustomersFirstName.Text = String.Empty; txtCustomersLastName.Text = String.Empty; return(cboCustomersCustomer.Items.Count - 1); } catch (VideoRentalException ex) { MessageBox.Show(ex.Message); return(Int32.MinValue); } catch { return(-1); } }