SHIFT to Open

  • Thread starter Thread starter Alb
  • Start date Start date
A

Alb

Hi,

does anyone know how to intercept the SHIFT key while opening a vb.net or C#
windowsforms application?
I would like to do something like MS Access when excluding autoexec macros.

thanks

Alberto
 
* "Alb said:
does anyone know how to intercept the SHIFT key while opening a vb.net or C#
windowsforms application?
I would like to do something like MS Access when excluding autoexec macros.

\\\
If (Control.ModifierKeys And Keys.Shift) <> 0 Then
...
End If
///
 
Maybe you can check the Control.Modifiers to see if teh shift is pressed.

public Form1(): base()
{
InitializeComponent();
if((Control.ModifierKeys & Keys.Shift) != 0)
{
MessageBox.Show("Shift key pressed");
}
}

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

Visit www.syncfusion.com for the coolest tools
 
Thanks for your help Herfried
but my application starts with the Sub Main routine.
Is there another solution?

Alberto
 
Thanks for your help Clay
but my application starts with the Sub Main routine.
Is there another solution?

Alberto
 
If you cannot use Control.ModifierKeys, then you can try to use interop and
call GetKeyState directly. How to do this is shown in this FAQ.

George Shepherd's Windows Forms FAQ contains an entry entitled:

How do I check the state of the virtual keys, Caps lock for example?

Check it out at:
http://www.syncfusion.com/faq/winforms/search/852.asp

=============================================
Clay Burch, .NET MVP
Syncfusion, Inc.
visit http://www.syncfusion.com for .NET Essentials
 
Back
Top