Datagridview + Enter key = Row down, Different column?

memozebadua used Ask the Experts™
Hi experts!

I have a problem with a datagrid. When the user ends modifying a cell data and presses Enter, it saves data to the database and the normal behavior of the datagrid is to select the next row but same column.
My datagridview does not do that. I have not been able to see why, I don'w know where I turned the wrong way.

I'll explain myself better:

I have a datagridview which I programatically fill with data, wait for the user to change an specific cell value (qty of order) and update database table and then fill the datagridview again with the new data (calculating final price).

I am currently using CellValueChanged for the database part, CellEndEdit to refill the datagridview, EditingControlShowing to be able to filter unwanted chars and Datagridview KeyUp to catch the Delete keycode.

My current query has a lot of unions, because the final user wants the datagridview list separated by product categories.

Any ideas?

Thank you, very much.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Senior Software Engineer
>>> Datagridview KeyUp to catch the Delete keycode.

comment this part in code and then execute. see what happened.


Thanks Shahan!

Did what you suggested, nothing happened. But applying your wisdom to the other events, commenting CellEndEdit gives me back the normal behavior of the datagridview, now I press Enter and it selects the cell below :)   Thanks.

But without this code in CellEndEdit, I can not calculate the final amount "on real time", just like Excel:

Equipment                     Qty         Unit Price        Amount

Box of Chocolates           1                 10                  10

Equipment                     Qty         Unit Price        Amount

Box of Chocolates           2                 10                  10           <== This should be 20. CellEndEdit code does this.

I wonder if there is any method that executes after CellEndEdit... Do you know?

Thanks in advance for helping me out with this :)
Shahan AyyubSenior Software Engineer

See this event:


does it work according to your requirement ?


Mmm tried it. But it went back to the odd behavior. So its definitively my re-fill method that's its messing with me.
Im awarding you the points as you helped identify the problem from all the code. But now I have to search for a fix for this.

Thanks for helping me out Shahan, really.


Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial