Link to home
Start Free TrialLog in
Avatar of Svenrutten
Svenrutten

asked on

check if Ctrl-Key is pressed...

Hello

My problem is the following:

I want that if I press the CTRL-Key that label1 should show "Multiple Selection possible"

I have this code:

    Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
        If e.KeyCode = Keys.ControlKey Then
            Label1.Text = "Multiple Selection possible"
        End If
    End Sub

And that is working but if I place a textbox on the form and the textbox has focus it is not working anymore...
I know that I could code this for every textbox too but can I not use this as main Form event which is overriding all other inputs?

Thanks a lot

Sven
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Svenrutten
Svenrutten

ASKER

Thanks a lot