|
-
Oct 31st, 2007, 10:40 AM
#1
Thread Starter
Frenzied Member
Read Alt-F1 in DGV double-click?
I want to have a feature in my program where if I hold Alt-F1 down while double-clicking on a DataGridView cell, it goes & does something. I tried This:
Code:
Private Sub ProcessDataGridView_CellDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles ProcessDataGridView.CellDoubleClick
If Control.ModifierKeys = (Keys.Alt Or Keys.F1) Then
'do something here
End If
End Sub
If I use just Keys.Alt alone it works when I hold the Alt key & double-click, but I want ALt-F1. Can anyone help me out? Thanks...
-
Oct 31st, 2007, 10:44 AM
#2
Re: Read Alt-F1 in DGV double-click?
Did yopu try Keys.Alt + Keys.F1
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
Oct 31st, 2007, 10:57 AM
#3
Re: Read Alt-F1 in DGV double-click?
That's because F1 is not a modifier key.
-
Oct 31st, 2007, 11:34 AM
#4
Thread Starter
Frenzied Member
Re: Read Alt-F1 in DGV double-click?
OK, so then it possible to read the Alt-F1 combo?
-
Oct 31st, 2007, 12:14 PM
#5
Fanatic Member
Re: Read Alt-F1 in DGV double-click?
Try this: Put the following code into the keydown event:
Code:
If e.Alt = True AndAlso e.KeyCode = Keys.F1 Then
'set a global bit = true
Else
'set bit = False
End If
Use the bit as a flag. Then when you click on the box have it check the bit. Now you know if the keycombo was pressed or not!
Good Luck,
D
Platforms of choice: Visual Studio 2005/2008 Professional : Visual Studio 2010 Enterprise : PHP - Notepad++/WAMP
Please Rate If I helped you. 
Please remember to mark threads as closed if your issue has been resolved.
Reserved Words in Access | Connection Strings
-
Oct 31st, 2007, 12:42 PM
#6
Thread Starter
Frenzied Member
Re: Read Alt-F1 in DGV double-click?
Thanks dminder, that works. Is this the only way it can be done?
-
Oct 31st, 2007, 12:49 PM
#7
Fanatic Member
Re: Read Alt-F1 in DGV double-click?
The key is that you have to detect the keypress prior to editing the cell. The keypress and the cell edit are 2 totally separate subs and do not know what the other is doing with out 3rd party assistance (enter the boolean).
I cannot think of any other way to do it, but if there are, I am sure others will post it!!
Good Luck again!
D
Platforms of choice: Visual Studio 2005/2008 Professional : Visual Studio 2010 Enterprise : PHP - Notepad++/WAMP
Please Rate If I helped you. 
Please remember to mark threads as closed if your issue has been resolved.
Reserved Words in Access | Connection Strings
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|