private void companySaveButton_Click(object sender, EventArgs e) { // Regex Name = new Regex(@"^[a-zA-Z]+(([',. -][a-zA-Z ])?[a-zA-Z]*)*$"); if (!Ch.IsMatch(companyTextBox.Text.Trim())) { cMessageBox.Information("Something went wrong"); } else { CompanyModel companyModel = new CompanyModel(); companyModel.Name = companyTextBox.Text.Trim(); SetupGateway companyGateway = new SetupGateway(); bool isExist = companyGateway.IsExistCompany(companyModel); if (isExist) { cMessageBox.Warning("Company Name Already Exist"); } else { int rowAffect = companyGateway.SaveCompany(companyModel); if (rowAffect > 0) { cMessageBox.Success("Company Successfully Saved"); CompanySetup_Load(sender, e); } else { cMessageBox.Failed("Failed to Save, Please Try Again"); CompanySetup_Load(sender, e); } } } // Expression check else function end here...... }