471,349 Members | 1,228 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,349 software developers and data experts.

Winform datagrid - cell value rejected using Alt key instead of bu

Dav
I have a Winform with a derived datagrid and a button that adds a row to the
datagrid in its Click event. The button has a shortcut text "&New Row".
When I enter a value in a datagrid cell and then mouse click the button
without tabbing out of the edited cell, everything is fine. If I hit Alt+N
instead after editing the cell, the cell values are reset to the previous
value of the cell before the button_click code is executed. I have tried
trapping various Key_down events, PreProcessMessage, etc. and this seems to
take place even before that. It seems that CancelEdit is implicitly being
called.

I would greatly appreciate any ideas about why this might be happening.
Thanks!!!
Jul 21 '05 #1
3 1836
Hi,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that when you're trying to use a shortcut
key to perform a button click and the editing cell value was rolled back.
If there is any misunderstanding, please feel free to let me know.

I tried this with a winform DataGrid control and it seem that there isn't
such problem happening. I think this issue might have something to do with
the derived datagrid. I suggest that you try to get the CurrencyManager of
the binding in Button.Click event and call EndCurrentEdit method explicitly
to see if it works.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #2
Dav
Hi Kevin,

Thank you for your help! I did try the CurrencyManager.EndCurrentEdit in
the button click and in other events, but it was not doing the trick. It did
lead me in the right direction and I was able to solve the problem by adding
a handler to the DatagridTextboxcolumn.Textbox's Validating event. In there
I called the Datagrid.EndEdit and the problem was fixed.

Thanks again!

"Kevin Yu [MSFT]" wrote:
Hi,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that when you're trying to use a shortcut
key to perform a button click and the editing cell value was rolled back.
If there is any misunderstanding, please feel free to let me know.

I tried this with a winform DataGrid control and it seem that there isn't
such problem happening. I think this issue might have something to do with
the derived datagrid. I suggest that you try to get the CurrencyManager of
the binding in Button.Click event and call EndCurrentEdit method explicitly
to see if it works.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #3
You're welcome! Thanks for sharing your experience with all the people
here. If you have any questions, please feel free to post them in the
community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Morten | last post: by
1 post views Thread by Marre | last post: by
3 posts views Thread by Sunil Sabir | last post: by
4 posts views Thread by Suzanne | last post: by
4 posts views Thread by tg | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.