except only double value in the datagridview
-
i want to accept the value 123.45 but when i enter the value 123.4.5 , it accepts the value. i have set format inputmaxlength as 10 DefaultCellStyle.Format ########.## In the keypreess event i have set to accept only integer and deceimal values. so How to set to accept only in the first format i.e 123.45 and not 123.4.5 Thank you
vijaya
-
i want to accept the value 123.45 but when i enter the value 123.4.5 , it accepts the value. i have set format inputmaxlength as 10 DefaultCellStyle.Format ########.## In the keypreess event i have set to accept only integer and deceimal values. so How to set to accept only in the first format i.e 123.45 and not 123.4.5 Thank you
vijaya
The DataGridView has a CellValidating event which is raised when a cell loses the focus. If you take a look at the MSDN documentation for it, there's a sample that shows how to validate the entry. The example looks at validating for an integer, but if you use double.TryParse instead it should do what you want.
-
i want to accept the value 123.45 but when i enter the value 123.4.5 , it accepts the value. i have set format inputmaxlength as 10 DefaultCellStyle.Format ########.## In the keypreess event i have set to accept only integer and deceimal values. so How to set to accept only in the first format i.e 123.45 and not 123.4.5 Thank you
vijaya