private void button1_Click(object sender, EventArgs e) { ValidateSupName(txtSupName); ValidateSupContact(txtSupcontact); ValidateSupIncharge(txtSupPersonIncharge); ValidateSupPersonContact(txtSupPersonContact); ValidateSupAddress(txtSupAddress); if (err.GetError(txtSupName).Length != 0) { err.SetError(txtSupName, "Please enter a value"); } else if (err.GetError(txtSupcontact).Length != 0) { err.SetError(txtSupcontact, "Please enter a numeric value of 10 digits long"); } else if (err.GetError(txtSupPersonIncharge).Length != 0) { err.SetError(txtSupPersonIncharge, "Please enter a value"); } else if (err.GetError(txtSupPersonContact).Length != 0) { err.SetError(txtSupPersonContact, "Please enter a numeric value of 10 digits long"); } else if (err.GetError(txtSupAddress).Length != 0) { err.SetError(txtSupAddress, "Please enter a value"); } else { varinsert.insertIntoSupplier(txtSupID.Text, txtSupName.Text, txtSupcontact.Text, cboType, txtSupPersonIncharge.Text, txtSupPersonContact.Text, cboSupCountry, txtSupEmail.Text, txtSupAddress.Text, dtpAgreementDate); varinsert.insertIntoGenSupplierNo(selectClass.GenSupplierNo().ToString()); clearAll(); ClearErrorProviderIcons(); } }