private void btnSelect_Click(object sender, EventArgs e) { if (cmbSelect.SelectedValue == null) { MessageBox.Show("Please select an owner to edit."); } else { try { int id = Convert.ToInt32(cmbSelect.SelectedValue.ToString()); editOwner = ownControl.GetOwner(id); string areaCode = editOwner.phoneNumber.Substring(0, 3); string firstThree = editOwner.phoneNumber.Substring(4, 3); string lastFour = editOwner.phoneNumber.Substring(8, 4); txtFirstName.Text = editOwner.firstName; txtLastName.Text = editOwner.lastName; txtStreet.Text = editOwner.streetAddress; txtCity.Text = editOwner.city; txtZip.Text = editOwner.zip; cmbState.Text = editOwner.state; txtEmail.Text = editOwner.emailAddress; txtPhoneAreaCode.Text = areaCode; txtPhoneFirstThreeDigits.Text = firstThree; txtPhoneLastFourDigits.Text = lastFour; } catch { MessageBox.Show("An error has occured, please try again"); } } }