收录日期:2019/03/26 02:58:43 时间:2009-07-29 17:58:06 标签:c#,visual-studio-2008

hi in c# i can do the following...

 dataGridView1.Columns["Column2"].ValueType = typeof(double);

is it possible also to provide the range for those double values entered on that column rows... for example i want user to enter only values between 0.0-100.0...? thanks a lot!

You can't do that by setting a property, but you can handle the CellValidating event and do the validation yourself.

You can then set the ErrorText property to an appropriate error message at the corresponding cell or row. You'll then have to set the ErrorText property to an empty string on the CellValidated event.