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

DataGridCell KeyDownEvent

Hi
I've used the following code to intercept a KeyEvent into a DataGrid.

******************************************
Private Sub DataGrid1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles DataGrid1.KeyDown
' Check if F2 Key is pressed.
If e.KeyCode = Keys.F2 Then
' Key pressed, Show MsgBox
MsgBox("F2 Key pressed!", MsgBoxStyle.Exclamation, "Ok, event Intercepted")
End If
End Sub
******************************************

When the cursor is into a cell of my DataGrid, the MsgBox doesn't appear. If I select, by example, the caption text part of the DataGrid control and then I press F2 Key, the event is intercepted and MsgBox appear!

But I don't want it. I want intercept the event when the cursor is located into a cell of my DataGrid!
What should I do to intercept that event?

Thanks in advance
-----------------------
Nicola Baldi
Nov 20 '05 #1
2 1614
Hi,

http://www.syncfusion.com/FAQ/WinFor...c44c.asp#q836q

Ken
--------------
"Nicola Baldi" <na*****@email.it> wrote in message
news:0A**********************************@microsof t.com...
Hi!
I've used the following code to intercept a KeyEvent into a DataGrid.

******************************************
Private Sub DataGrid1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles DataGrid1.KeyDown ' Check if F2 Key is pressed.
If e.KeyCode = Keys.F2 Then
' Key pressed, Show MsgBox
MsgBox("F2 Key pressed!", MsgBoxStyle.Exclamation, "Ok, event Intercepted") End If
End Sub
******************************************

When the cursor is into a cell of my DataGrid, the MsgBox doesn't appear. If I select, by example, the caption text part of the DataGrid control and
then I press F2 Key, the event is intercepted and MsgBox appear!
But I don't want it. I want intercept the event when the cursor is located into a cell of my DataGrid! What should I do to intercept that event?

Thanks in advance.
------------------------
Nicola Baldi

Nov 20 '05 #2
Hi,

http://www.syncfusion.com/FAQ/WinFor...c44c.asp#q836q

Ken
--------------
"Nicola Baldi" <na*****@email.it> wrote in message
news:0A**********************************@microsof t.com...
Hi!
I've used the following code to intercept a KeyEvent into a DataGrid.

******************************************
Private Sub DataGrid1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles DataGrid1.KeyDown ' Check if F2 Key is pressed.
If e.KeyCode = Keys.F2 Then
' Key pressed, Show MsgBox
MsgBox("F2 Key pressed!", MsgBoxStyle.Exclamation, "Ok, event Intercepted") End If
End Sub
******************************************

When the cursor is into a cell of my DataGrid, the MsgBox doesn't appear. If I select, by example, the caption text part of the DataGrid control and
then I press F2 Key, the event is intercepted and MsgBox appear!
But I don't want it. I want intercept the event when the cursor is located into a cell of my DataGrid! What should I do to intercept that event?

Thanks in advance.
------------------------
Nicola Baldi

Nov 20 '05 #3

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

Similar topics

2
by: jinu | last post by:
In a vb.net application, we are using the DataGridColoredTextBoxColumn class which is derived from DataGridTextBoxColumn class inorder to give additional colouring features. For aligning certain...
6
by: Tamir Khason | last post by:
How to prevent the selected cell from being editable (visual) at DataGrid? Once click on cell (even readonly) there are cursor inside it and select text appears. How to prevent it Thankx
2
by: Moshe Lupiansky via .NET 247 | last post by:
(Type your message here) 1 - How do I programmatically assign a value to a specified cell in a DataGrid? Something like DataGrid1(3,8) = "ABC" 2 - When I am going to the last row (the empty...
3
by: DraguVaso | last post by:
Hi, I'm able to set the Font in a Datagrid-Cell to Bold with g.DrawString(Me.GetColumnValueAtRow(source, rowNum).ToString, e.TextFont, e.ForeBrush, bounds.X, bounds.Y) and to Align the text...
0
by: Nicola Baldi | last post by:
Hi I've used the following code to intercept a KeyEvent into a DataGrid. ****************************************** Private Sub DataGrid1_KeyDown(ByVal sender As Object, ByVal e As...
4
by: Lars Netzel | last post by:
I want a datagrid cell to be a combobox (based on database records) and when you select a value in the combobox I want to add info to cells on the same row in the datagrid but with More info from...
1
by: Karl | last post by:
Hi there, I have a problem needs help. In a winform, I have a datagrid. In Mouse move event, I can get coodinates of Mouse. I want to decide which datagridcell my mouse is on. Can anybody...
6
by: Doug Bell | last post by:
Hi I have a DataGrid with some hidden columns and also some read Only and some ComboBox Columns. Sandard Tabbing through the Datagrid sees the focus go to the hidden columns requiring further...
13
by: Smish | last post by:
hey can ne1 tell me how to color the corner of a cell in the datagridview
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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...
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
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...
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,...

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.