FlexGrid WinForms VB.NET Editing/Inserting issue

Posted by: mwebster on 15 March 2021, 11:37 am EST

    • Post Options:
    • Link

    Posted 15 March 2021, 11:37 am EST

    I have a bit of an issue on a VB.NET Winforms application using FlexGrid. I was sent this sample but it is in C# which I am not very familiar with and cannot make use of it.

    https://www.grapecity.com/forums/winforms-edition/flexgrid---adding-and-edit

    I have a Flex Grid and am allowing the user to make changes/insert rows. I am using the AfterEdit event to apply the changes but that event fires after every column is edited even if PreserveEditMode is set to true. Ideally, I want the user to hit Enter to end editing and commit the changes to the database but I am unable to figure out how to make that work.

    Alternatively, if I knew when the user exited from the current row, I could make that work.

  • Posted 16 March 2021, 12:40 am EST

    Hi,

    The AfterEdit event is fired every time after a cell has been edited. You can use the RowValidated event to update the database as it fires when a row loses focus and is validated. Please refer to the sample attached.

    If you need further assistance, please let us know.

    Regards.

    Avnish

    FlexGridRowUpdate.zip

  • Posted 16 March 2021, 6:42 am EST

    Thanks I will have a look and let you know.

  • Posted 16 March 2021, 10:01 am EST

    This doesn’t work. The problem is that my underlying datatable contains a field that is not part of the FlexGrid (CatalogCodeID). When my code executes to save the record, it sets that Product Code, it updates the database. Unless I reload the dataset, which throws the user off of the current row they are editing in the FlexGrid, cm.EndCurrentEdit generates a runtime error saying that the CatalogCodeID value cannot be null.

    Also, the RowValidated event does not seem to only fire when a use exits a row. If I had some way to know when a user existed a row, I could make this work.

  • Posted 16 March 2021, 10:04 am EST

    If there was some way to end editing only when Enter was pushed, that would be even better.

  • Posted 16 March 2021, 10:55 am EST

    Looks like the AfterValidate thing does solve the issue after all. Thanks for your help.

  • Posted 17 March 2021, 2:07 am EST

    Happy to help.

    Regards.

    Avnish

Need extra support?

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

Learn More

Forum Channels