判断文本框输入的内容是否为汉字,利用文本框的键盘事件KeyPressEventArgs;
public static bool IsChinese(KeyPressEventArgs e,DevExpress.XtraEditors.TextEdit text) { if ((e.KeyChar >= (char)0x4e00) && (e.KeyChar <= (char)0x9fa5) || (byte)(e.KeyChar) == 8) { e.Handled = false; return true; } else { e.Handled = true; return false; } }