We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

currency cell precision question

Thread ID:





70728 Dec 27,2007 10:03 PM UTC Jan 10,2008 12:18 AM UTC WinForms 6
Tags: GridControl
Julie Levy
Asked On December 27, 2007 10:03 PM UTC

Hi -
I am using the GridControl, version
I have currency cells with CurrencyDecimalDigits = 2 and CellValueType = double.

When i set the value to be something like 0.0000001, i get the following behavior. When not in edit mode, the value displayed in the cell is "0.00". When the user enters the cell to edit, the value is "107.00". When i step through the code and trap the CurrentCellStartEditing event, i see the following:
CurrentCell.Renderer.ControlValue = 0.0000001
CurrentCell.Renderer.ControlText = "0.00"
CurrentCell.Renderer.Control.Text = "107.00"

I understand the zero value and am fine with that. But why the 107? What can i do to prevent this.


haneefm [Syncfusion]
Replied On December 27, 2007 10:30 PM UTC

Hi Julie,

One way you can do this by hanlding the CurrentCellInitializeControlText event of the grid and set the e.ControlText to newText. Below are the codes:

this.gridControl1.CurrentCellInitializeControlText += new GridCurrentCellInitializeControlTextEventHandler(gridControl1_CurrentCellInitializeControlText);

void gridControl1_CurrentCellInitializeControlText(object sender, GridCurrentCellInitializeControlTextEventArgs e)
e.ControlText = Convert.ToString( e.Style.FormattedText ) ;

Best regards,

Julie Levy
Replied On December 28, 2007 07:19 PM UTC

Thanks for your response. This seems to work ok.

Julie Levy
Replied On January 3, 2008 10:59 PM UTC

Hi -
Actually this doesn't work.
If you tab into a cell and then just start typing... the initialize event is triggered and the formatted text is "" which overwrites what was typed.
If you click into the cell first, the initialize event is triggered before the user has typed and, thus, everything is ok.

Any other ideas on how to handle this or anything i can check?


Julie Levy
Replied On January 3, 2008 11:15 PM UTC

Hi -
Basically any time you tab into a cell to edit it (whether it's empty or has a value), the old value contained in the style overwrites what the user is typing on the first keystroke.

So I don't think this approach can work for me. Any idea why the controltext is 107 in my original example. Is there a way to "fix" this so i don't have to do anything in the intialize event.


SubhaSheela R [Syncfusion]
Replied On January 9, 2008 10:14 AM UTC

Hi Julie,

We suspect the issue "ActiveCurrencyCell shows default value" to be a defect. Could you please create a Direct-Trac incident with the subject "F70728 - Active currency cell shows default value" so that we could give more details regarding the fix?

Subhasheela R

Julie Levy
Replied On January 10, 2008 12:18 AM UTC



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon