473,372 Members | 997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 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 1945
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: PeterZ | last post by:
G'day, After doing much searching and pinching bits of ideas from here there and everywhere I came up with a fairly 'clean' solution of including a comboBox into a dataGrid column. You can...
9
by: Morten | last post by:
Hi! I have a problem displaying some values in a datagrid. I have an array that consists of a number of objects. Each object has 2 properties: Name and a list of web addresses. (e.g: Name:...
1
by: Marre | last post by:
Hi all! I have made a datagrid on a winform and want to get the text out of the first cell when I have the row selected. Lets say I have a grid with som info and want to view more info about the...
3
by: Sunil Sabir | last post by:
Dear All, I have a datagrid which displays the column of Names of doctors.When I use e.item.cell(5).Text. I see the name of two doctors instead of one.In the database the doctors name are: ...
4
by: Suzanne | last post by:
Hi all, I'm having problems with datagrids and the currentcellchanged event. My problem is this: I have a datagrid on a form, if the user changes the text in a cell on the datagrid then tries to...
4
by: tg | last post by:
Visual Studio 2003 My problem is that I am dynamically creating a datagrid on pageload. The datagrid is completely dynamic as it is based on the number of columns returned from a recordset. The...
3
by: Dav | last post by:
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...
3
by: Jeff | last post by:
Help.. I have been using: string sId = ((System.Web.UI.WebControls.TextBox)e.Item.Cells.Controls).Text; To get the value of a cell in my datagrid. When I set the cell to read only, I get...
0
by: Mythran | last post by:
I have seen many examples on the Internet that do the following to format data being bound to a DataGrid....IMO, it's sick.. Public Sub MyGrid_ItemDataBound( ... ) Dim value As String =...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.