Coding :
private void txt_PreviewTextInput(object sender, TextCompositionEventArgs e) { e.Handled = !ValidNumeric(e.Text); base.OnPreviewTextInput(e); } bool ValidNumeric(string str) { bool ret = true; int l = str.Length; for (int i = 0; i < l; i++) { char ch = str[i]; ret &= Char.IsDigit(ch); } return ret; }
Thanks dedjo
Popularity: 5% [?]

September 28th, 2009
joy
Posted in
Tags:

