private void txtAge_KeyPress(object sender, KeyPressEventArgs e) { string str = txtAge.Text; // User Control int len = str.Length; int index = 0; int dcml = 2; // 2 indeicates the Deccimal Points Needed (User Defined) if (str.Contains('.')) { index = str.IndexOf('.'); index = len - index; } if (Char.IsControl(e.KeyChar) == false) { if (((Char.IsDigit(e.KeyChar)) && (index <= dcml)) || ((e.KeyChar == '.') && (!(str.Contains('.'))))) { } else { e.Handled = true; } } }
System.Windows.Forms.DataGridView.CellFormatting
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)