public void btnSubmit_Click(object sender, EventArgs e) { textBoxFirst.Focus(); lblMessage.ForeColor = System.Drawing.Color.Maroon; if (textBoxFirst.Text == "" || textBoxLast.Text == "" || textBoxPhone.Text == "") { lblMessage.Text = "Please fill in information"; } else { if (textBoxFirst.Text.IndexOfAny("0123456789".ToCharArray()) == -1 && textBoxLast.Text.IndexOfAny("0123456789".ToCharArray()) == -1 && textBoxPhone.Text.IndexOfAny("0123456789".ToCharArray()) != -1) { // correct information will add a new customer lblMessage.Text = ""; string fname = textBoxFirst.Text.Trim(); string lname = textBoxLast.Text.Trim(); string phone = textBoxPhone.Text.Trim(); if (currentCoord.addCustomer(fname, lname, phone)) { lblMessage.ForeColor = System.Drawing.Color.Black; lblMessage.Text = "Customer Added Succesfully"; textBoxFirst.Text = ""; textBoxLast.Text = ""; textBoxPhone.Text = ""; } else { lblMessage.Text = "Customer Not Added"; } } else if (textBoxFirst.Text.IndexOfAny("0123456789".ToCharArray()) != -1 || textBoxLast.Text.IndexOfAny("0123456789".ToCharArray()) != -1) { lblMessage.Text = "Customer Not Added - First and Last name cannot contain numbers"; } else if (textBoxPhone.Text.IndexOfAny("0123456789".ToCharArray()) == -1) { lblMessage.Text = "Customer not Added - Phone Number must have no letters"; } else { lblMessage.Text = "Customer Not Added"; } } }