protected static void CheckIntPasting(object sender, DataObjectPastingEventArgs e) { if (e.DataObject.GetDataPresent(typeof(String))) { String text = (String)e.DataObject.GetData(typeof(String)); if (!CheckText.IsInt(text)) { e.CancelCommand(); } } else { e.CancelCommand(); } }
protected static void CheckIntKeyDown(object sender, TextCompositionEventArgs e) { e.Handled = !CheckText.IsInt(e.Text); }