473,405 Members | 2,310 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,405 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 1947
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.