Solved

check if Ctrl-Key is pressed...

Posted on 2004-10-24
799 Views
Last Modified: 2007-12-19
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
0
Question by:Svenrutten
    2 Comments
     
    LVL 85

    Accepted Solution

    by:
    Set the KeyPreview property of the form to True.

    ~IM
    0
     

    Author Comment

    by:Svenrutten
    Thanks a lot
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Lean Six Sigma Project Manager Certification

    There are many schools of thought around successful project management, but few as highly regarded as the Six Sigma and Lean methods. With 37 hours of learning, this training will explain concrete processes for increasing efficiency and limiting wasted time and effort.

    I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
    A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
    This video Micro Tutorial is the first in a two-part series that shows how to create and use custom scanning profiles in Nuance's PaperPort 14.5 (http://www.experts-exchange.com/articles/17490/). But the ability to create custom scanning profiles al…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    845 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now