Weird Numeric problem in Grid!

  • Thread starter Thread starter Lars Netzel
  • Start date Start date
L

Lars Netzel

Hello!

I have a Cell in a datagrid (a text cell) that is loaded from the database.
The type in the databas on that field is "double" with 1 decimal.

I have a style added to the cell that has formatting string "### ##0.0" so
that it will always at least show a decimal with a 0 even though there's no
decimal on..

My problem is that I can't enter any other decimal than "0".

If I load a value from the database that is 123,6 it's gonan show 124,0
If I enter 123,6 into the field.. it shows as 123,0
If I enter 230,123 into a field that already says 123,0 it will show as
123,0 (so it's liek is doesn't accept me using decimals when typing.

I have tested the differance with "." and "," but it gives the same result.

I figured I had some code in CurrentCellChanged that messed things up but
it's not even firering that event so It has to be the Formatting thing or?

Please help
/Lars
 
Hi,


Try something like this.

Dim cm As CurrencyManager = CType(Me.BindingContext(arBind),
CurrencyManager)

Dim pd As System.ComponentModel.PropertyDescriptor =
cm.GetItemProperties()("Qty")

Dim ni As New System.Globalization.NumberFormatInfo

ni.NumberDecimalDigits = 1

Dim colQty As New DataGridTextBoxColumn(pd, "f")

With colQty

..MappingName = "Col1"

..HeaderText = "Qty"

..Width = 75

..FormatInfo = ni

End With



Ken

------------------------------

Hello!

I have a Cell in a datagrid (a text cell) that is loaded from the database.
The type in the databas on that field is "double" with 1 decimal.

I have a style added to the cell that has formatting string "### ##0.0" so
that it will always at least show a decimal with a 0 even though there's no
decimal on..

My problem is that I can't enter any other decimal than "0".

If I load a value from the database that is 123,6 it's gonan show 124,0
If I enter 123,6 into the field.. it shows as 123,0
If I enter 230,123 into a field that already says 123,0 it will show as
123,0 (so it's liek is doesn't accept me using decimals when typing.

I have tested the differance with "." and "," but it gives the same result.

I figured I had some code in CurrentCellChanged that messed things up but
it's not even firering that event so It has to be the Formatting thing or?

Please help
/Lars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top