private void BtnAddcust_Click(object sender, EventArgs e) { try { if (!Global.InputHandle(TxtEmail)) { throw new Exception("Enter Email address"); } if (!Global.IsValidEmail(TxtEmail.ToString())) { throw new Exception("Invalid Email address"); } loyalcustomer = new LoyalCustomer(); loyalcustomer.Email = TxtEmail.Text; bool flag = loyalcustomer.AddLoyalCustomer(); if (flag == true) { MessageBox.Show("Loyal Customer added"); TxtEmail.Text = ""; } else { MessageBox.Show("Email address already exist"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }