This project is read-only.

Decimal in numericUpDown cell editor

Feb 21, 2013 at 7:27 PM
Hi there!

I Need some help regarding a numericUpDown cell ecitor type.

I want to use decimal which of course basically is no problem. However, i want to do two things which i couldn't get working so far:

1.) Limit the number of decimal places to 1
2.) While editing the decimal places are not shown - the number is always rounded to 0 decimal places

Any ideas?

Thank you!

P.s. Awesome Project - i love it!:)
Feb 22, 2013 at 2:15 AM

Probably DecimalPlaces needs to be set manually. Here is a modified sample from frmSample03.cs
    grid[currentRow, 1] = new SourceGrid.Cells.Cell(0);
    SourceGrid.Cells.Editors.NumericUpDown l_NumericUpDownEditor = new SourceGrid.Cells.Editors.NumericUpDown(typeof(decimal), 50, -50, 0.1m);
    l_NumericUpDownEditor.Control.DecimalPlaces = 1;
    grid[currentRow, 1].Editor = l_NumericUpDownEditor;
Also, select CellType to allow decimal expression like typeof(decimal) instead of typeof(int) which is originally used in frmSample03.