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

KeyPress Event not Firing???

Hi,

I am trying to catch the KeyPress event on my datagrid but it isn't
working... i have also tried registering the handler with the event like
this...

dgGLBatch.KeyPress += new KeyPressEventHandler(dgGLBatch_KeyPress);

but nothing changed. I was wondering wether a custom table and column style
might have an effect on how this works???
my code is below...

private void dgGLBatch_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e) {

if(e.KeyChar == (char)13)

SendKeys.Send("{TAB}") ;

}
Regards

Darryn
Nov 16 '05 #1
3 7302
You have to set the KeyPress event to the TextBox Column only, not to the Grid.

Regards,
Amal

"Darryn Ross" wrote:
Hi,

I am trying to catch the KeyPress event on my datagrid but it isn't
working... i have also tried registering the handler with the event like
this...

dgGLBatch.KeyPress += new KeyPressEventHandler(dgGLBatch_KeyPress);

but nothing changed. I was wondering wether a custom table and column style
might have an effect on how this works???
my code is below...

private void dgGLBatch_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e) {

if(e.KeyChar == (char)13)

SendKeys.Send("{TAB}") ;

}
Regards

Darryn

Nov 16 '05 #2
And how do you do that when there is no KeyPress event under
DataGridTextBoxColumn?
"AMALORPAVANATHAN YAGULASAMY (AMAL)"
<AM****************************@discussions.micros oft.com> wrote in message
news:14**********************************@microsof t.com...
You have to set the KeyPress event to the TextBox Column only, not to the Grid.
Regards,
Amal

"Darryn Ross" wrote:
Hi,

I am trying to catch the KeyPress event on my datagrid but it isn't
working... i have also tried registering the handler with the event like
this...

dgGLBatch.KeyPress += new KeyPressEventHandler(dgGLBatch_KeyPress);

but nothing changed. I was wondering wether a custom table and column style might have an effect on how this works???
my code is below...

private void dgGLBatch_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e) {

if(e.KeyChar == (char)13)

SendKeys.Send("{TAB}") ;

}
Regards

Darryn

Nov 16 '05 #3
try DataGridTextBoxColumn.TextBox.KeyPress.

=================
Clay Burch, .NET MVP

Visit www.syncfusion.com for the coolest tools

"Darryn Ross" <da****@datawave.com.au> wrote in message
news:uz**************@TK2MSFTNGP12.phx.gbl...
And how do you do that when there is no KeyPress event under
DataGridTextBoxColumn?
"AMALORPAVANATHAN YAGULASAMY (AMAL)"
<AM****************************@discussions.micros oft.com> wrote in message news:14**********************************@microsof t.com...
You have to set the KeyPress event to the TextBox Column only, not to the
Grid.

Regards,
Amal

"Darryn Ross" wrote:
Hi,

I am trying to catch the KeyPress event on my datagrid but it isn't
working... i have also tried registering the handler with the event like this...

dgGLBatch.KeyPress += new KeyPressEventHandler(dgGLBatch_KeyPress);

but nothing changed. I was wondering wether a custom table and column

style might have an effect on how this works???
my code is below...

private void dgGLBatch_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e) {

if(e.KeyChar == (char)13)

SendKeys.Send("{TAB}") ;

}
Regards

Darryn


Nov 16 '05 #4

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

Similar topics

8
by: William Ortenberg | last post by:
I'm trying to capture when a user presses a particular key (escape), so I'm coding in the KeyPress event. Yet the code seems be bypassed (breakpoint is never encountered). Should I be coding in a...
4
by: john sutor | last post by:
When moving up and down with the arrow keys on my DataGrid, I cannot get either the Keypress, KeyUp or KeyDown events to respond. I am putting breakpoints in to capture the event but they never...
7
by: | last post by:
Hello to all I'm handling the Validating event for one text box. If something is wrong in user input I show a warning message. The problem is that if I add to method the message is displayed...
4
by: Tom | last post by:
I have a VB.NET user control that I wrote - this control has three or four other controls on it (textbox, combobox, datetime picker, etc). Now, whenever the control is on a form and the user enters...
3
by: Terry Olsen | last post by:
Is there anyway to cause a KeyPress event in a datagrid cell? The only way I get a keypress event is if none of the cells are selected. I was hoping to have the program respond to a certain...
8
by: EdB | last post by:
I am testing in a TextBox KeyPress event to validate characters in the TextBox. How do I tell it to abort appending my "e" if I deem the character invalid. I note that on a Form Closing event, e...
3
by: JAG711 | last post by:
I have 2 mdi childforms which are database input forms. Each form has the usual add/delete/edit/save buttons and a few textboxes. I capture the keypress events on the textboxes to allow only...
3
by: Nikolay Evseev | last post by:
Hi, I am trying to trace down the Enter key in my Form.KeyPress event handler. The KeyPreview property is set to false, so I'd assume that all key presses should go through my form's KeyPress...
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: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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?
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.