PC Review


Reply
Thread Tools Rate Thread

DataGridCell KeyDownEvent

 
 
=?Utf-8?B?Tmljb2xhIEJhbGRp?=
Guest
Posts: n/a
 
      8th Apr 2004
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
 
Reply With Quote
 
 
 
 
Ken Tucker [MVP]
Guest
Posts: n/a
 
      8th Apr 2004
Hi,

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

Ken
--------------
"Nicola Baldi" <(E-Mail Removed)> wrote in message
news:0AF6797A-0A94-4A2C-B42A-(E-Mail Removed)...
> 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



 
Reply With Quote
 
=?Utf-8?B?Q2FybWVuIGRlIExhcmE=?=
Guest
Posts: n/a
 
      18th May 2004
Hi, i have the same problem, i saw the code but i don't know how to raise an event handler to trap de F2 key control and then show a new form. Please help me.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Datagridcell paint problem =?Utf-8?B?amludQ==?= Microsoft Dot NET 2 19th Aug 2004 06:21 AM
Combobox in Datagridcell? Lars Netzel Microsoft VB .NET 5 11th May 2004 09:04 PM
Programmatically assigning a value to a DataGridCell Moshe Lupiansky via .NET 247 Microsoft C# .NET 2 17th Apr 2004 08:36 PM
Best way to bind Controls to a DataGridCell DraguVaso Microsoft Dot NET Framework Forms 0 25th Mar 2004 02:58 PM
Edit mode of DataGridCell Tamir Khason Microsoft C# .NET 6 25th Dec 2003 11:01 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:43 AM.