public bool isPresent(DevExpress.XtraEditors.TextEdit textbox, string name) { if (string.IsNullOrEmpty(textbox.Text)) { DevExpress.XtraEditors.XtraMessageBox.Show(name + " is a requierd field", "Entry error", MessageBoxButtons.OK, MessageBoxIcon.Error); textbox.Select(); return false; } else { return true; } }
public static bool isNumeric(DevExpress.XtraEditors.TextEdit textbox, string name) { try { Convert.ToInt32(textbox.Text); return true; } catch (Exception ex) { MessageBox.Show(name + "must be a numeric value.", "Entry Error", MessageBoxButtons.OK, MessageBoxIcon.Error); textbox.Select(0, textbox.Text.Length); Debug.WriteLine(ex.Message); return false; } }
public static bool isReqired(DevExpress.XtraEditors.TextEdit textbox, string name, ErrorProvider Errorprovider) { if (string.IsNullOrEmpty(textbox.Text)) { //MessageBox.Show(name & " is a requierd field", "Entry error", MessageBoxButtons.OK, MessageBoxIcon.Error) Errorprovider.SetError(textbox, "This is a required"); MessageBox.Show(name + " is a requierd field", "Entry error", MessageBoxButtons.OK, MessageBoxIcon.Error); textbox.Select(); return false; } else { Errorprovider.Clear(); return true; } }