Have issues formatting C1FlexGrid using C1NumericEdit as Editor

Posted by: mhamilton on 14 December 2021, 1:42 pm EST

    • Post Options:
    • Link

    Posted 14 December 2021, 1:42 pm EST

    Hello,

    I’m having an issue using a C1NumericEdit as an editor for a C1FlexGrid. My goal is to use the C1NumericEdit to apply a custom format for double values entered into the C1FlexGrid.

    In the example I attached I’m wanting any number greater than 100 to be displayed in scientific notation and any other number displayed as a normal decimal number. In the attached example the C1NumericEdit works correctly but the C1FlexGrid does not.

    The C1FlexGrid only displays a decimal value no matter what I enter. I created the CellStyle and assign the Editor to the C1NumericEdit . I see the call to the Format method and I see it set the e.Text correctly but the displayed value in the grid is not correct.

    I assume I’m missing something simple but any help would be appreciated greatly.

    FlexGridWindowsFormsApp.zip

  • Posted 15 December 2021, 3:14 am EST

    Hi,

    The Editor used in the cells is only active till the cell is being edited. After finishing the edit, the editor sets the value back to the cell then the display is handled by the grid according to format or cell style applied, as the formatting was applied to the editor and not the grid, that formatting is lost.

    If you want to see formatted data after editing, you can use the OwnerDrawCell event to apply the formatting according to your condition. Kindly refer to the modified sample showing the same.

    FlexGridWindowsFormsApp.zip

    JFYI, if you are using the C1NumericEdit only to show formatted values in the grid based on your condition, you can directly implement it in the grid by using the OwnerDrawCell event. Kindly refer to the attached sample showing the same.

    DemoFG.zip

    Please let us know if you need any other information.

    Regards,

    Avnish

  • Posted 15 December 2021, 2:54 pm EST

    Awesome! Thank you for the explanation and helpful tips. I appreciate the support.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels