Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
250
Decimal Separator has to be a "comma" ...
posted

Hi,

I'm having a problem when "entering" values of type Double in a cell.

First of all, my grid is bound to a datatable.

This datatable contains mainly double values.

I'm living in Belgium, so our decimal separator is a comma "," (CultureInfo = "nl-BE")

All values are shown correctly in the grid. So far, so good.

But when editing the decimal values in the grid, and when pressing the "."-button on the numeric keypad, also a point "." is shown in the cell.

"Johnny, this is normal" ... should be a normal reaction from your side ...

But, as an example, when pressing the same button in Windows Calculator, a comma "," is shown...

Surprising, no ... ?

So, my "users" are expecting the "Windows decimal separator" (in our case , a comma) when entering values in a wingrid.

Any idea how to solve this in a smooth way ?

Thanks in advance for your answer,

Grtz,

  • 250
    posted

    Problem solved !!

    Sample Code:

    Dim SalCol As UltraGridColumn = Me.UltraGrid1.DisplayLayout.Bands(0).Columns("Salary")


            ' Set the Format and FormatInfo properties.
            ' You don't have to set both. You can set one or the other or both.
            ' Play with it, and have fun !


            SalCol.Format = "##.###"
            SalCol.CellAppearance.TextHAlign = HAlign.Right
            SalCol.PromptChar = ""
            SalCol.Style = ColumnStyle.Double
            SalCol.FormatInfo = System.Globalization.CultureInfo.CurrentCulture