public static bool isValidTel(String str) { if (Support.isNumeric(str) && str.Length == 10) { return(true); } else { return(false); } }
public static bool isValidNIC(String NIC) { if (NIC.Length == 9 && Support.isNumeric(NIC)) { return(true); } else if (NIC.Length == 10 && Support.isNumeric(NIC.Substring(0, 9))) { if (NIC.Substring(9, 1) == "v" || NIC.Substring(9, 1) == "V" || NIC.Substring(9, 1) == "x" || NIC.Substring(9, 1) == "X") { return(true); } else { return(false); } } else { return(false); } }
private void tbx12New_TextChanged(object sender, EventArgs e) { if (tbx12New.Text.Length > 0) { if (Support.isNumeric(tbx12New.Text) && Support.isValidAmount(tbx12New.Text)) { btnSave.Enabled = true; new12UnitPrice = decimal.Parse(tbx12New.Text); } else if (tbxSingleNewPrice.Text.Length == 0) { btnSave.Enabled = false; tbx12New.Clear(); new12UnitPrice = 0; MessageBox.Show("Value you entered is not valid!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { tbx12New.Clear(); MessageBox.Show("Value you entered is not valid!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); new12UnitPrice = 0; } } }