473,395 Members | 1,774 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,395 software developers and data experts.

Detecting Keystrokes in a DataTable

I have a DataTable in a DataGrid on a Windows form.

I have comboboxes in the first column, and that seems to work just fine.

The second column is for a money amount. The numeric dollar value doesn't
get saved to the cell until I hit <Enter> or tab to the next cell.

I'd really like to be able to detect each keystroke in the cell, so it would
be just like an Excel spreadsheet. I'd settle for the ability to save
whatever numbers are in the cell with a button press - like when I hit my
Save button.

Any thoughts are appreciated...

Randy
Nov 16 '05 #1
2 1390
How are your comboboxes implemented? It sounds like it's in an Edit state
and the only events on the table are RowChanging, Changed, ColumnChanging,
Changed so you are going to have to trap those through the control.

--

W.G. Ryan, eMVP

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/...ity/newsgroups
"Randy" <rb***@sumaria.net> wrote in message
news:jF*******************@nwrdny02.gnilink.net...
I have a DataTable in a DataGrid on a Windows form.

I have comboboxes in the first column, and that seems to work just fine.

The second column is for a money amount. The numeric dollar value doesn't
get saved to the cell until I hit <Enter> or tab to the next cell.

I'd really like to be able to detect each keystroke in the cell, so it would be just like an Excel spreadsheet. I'd settle for the ability to save
whatever numbers are in the cell with a button press - like when I hit my
Save button.

Any thoughts are appreciated...

Randy

Nov 16 '05 #2
The first column, the combobox column, is implemented with
DataGridComboBoxColumn, which inherits from DataGridTextBoxColumn, and
overrides Edit, GetColumnValueAtRow, SetColumnValueAtRow, and has a combobox
leave event.

The second column is DataGridMoneyColumnStyle, which is just a
DataGridTextBoxColumn with formatting for dollars and cents.

Are you suggesting I need to override Edit in my DataGridMoneyColumnStyle
class?

In my form class, I setup event handlers for RowChanging, Changed,
ColumnChanging, Changed, but those only fire after hitting tab or <Enter> in
the money column cell. Again, my goal is fire an event after each keystroke
in the money cell, just like an Excell spreadsheet would do.

Thanks,
Randy
"William Ryan eMVP" <do********@comcast.nospam.net> wrote in message
news:Oc*************@tk2msftngp13.phx.gbl...
How are your comboboxes implemented? It sounds like it's in an Edit state
and the only events on the table are RowChanging, Changed, ColumnChanging,
Changed so you are going to have to trap those through the control.

--

W.G. Ryan, eMVP

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/...ity/newsgroups
"Randy" <rb***@sumaria.net> wrote in message
news:jF*******************@nwrdny02.gnilink.net...
I have a DataTable in a DataGrid on a Windows form.

I have comboboxes in the first column, and that seems to work just fine.

The second column is for a money amount. The numeric dollar value doesn't get saved to the cell until I hit <Enter> or tab to the next cell.

I'd really like to be able to detect each keystroke in the cell, so it

would
be just like an Excel spreadsheet. I'd settle for the ability to save
whatever numbers are in the cell with a button press - like when I hit my Save button.

Any thoughts are appreciated...

Randy


Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Holden Caulfield | last post by:
Does anyone know how to detect if a user has pasted code using the right mouse button into a textarea? I have fields in a form that autoupdate when text is changed in a textarea, but if it is...
1
by: Alex | last post by:
Hi all... I have a DataGrid bound to a DataTable. My DataTable gets updated programmatically as it contains the status of a number of worker threads. Each "main" worker thread launches a...
2
by: epigram | last post by:
I have a form on a web page that contains several textbox controls (i.e. input type="text") and a checkbox. As soon as the text changes, in only a subset of these textbox controls, I want to...
0
by: RA | last post by:
Hi I am getting the DataGrid row click event. My question is how can I get the DataTable that is corresponding to the DataGrid row. This is not one to one relationship because the DataGrid might...
1
by: PeterZ | last post by:
Hi, I have two tables and a dataRelation (win forms project). The dataRelation is bound to a dataGrid. I'm trying to detect when a user navigates to a new row in the datagrid so I can obtain a...
5
by: Lucas Tam | last post by:
Hi all, Has anyone done this before? Send client side keystrokes to an application from a webpapge? This maybe more of a Javascript question. In short, I have an application on the client's...
3
by: Gunnar Syren | last post by:
I'm trying to implement a macro feature in my application by recording and playing back keystrokes. At first I thought it would be enough to catch KeyDown in my main form, but I soon realized that...
1
by: ChrisM | last post by:
Hi, I have a DataTable. When the table is validated, I'm setting the DataRow.RowError text for certain rows that don't match a particular criteria. This puts a nice red '!' on the DataGrid that...
3
by: dbuchanan | last post by:
How, at rundime, do I capture the fact that the parametrized query that fills a CheckBoxList results in an empty set. When the dataset is empty the CheckBoxList does not appear. I would like to...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.