Solved

How do I tect a 'Ctrl'-'A' being pressed with a ListView control

Posted on 2008-06-26
4
390 Views
Last Modified: 2008-08-15
As perthe question above (in VB .NET 2005)

Thanks
0
Comment
Question by:FINDERSOL
4 Comments
 
LVL 14

Accepted Solution

by:
rachitkohli earned 500 total points
ID: 21877800
On keydown event of ListView write

If (e.KeyCode = Keys.A And e.Modifiers = Keys.Control) Then
  MsgBox "Ctrl + A Pressed..!!"
End If
0
 
LVL 27

Expert Comment

by:planocz
ID: 21878298
If you want to check for any time the Ctrl -A is pressed you can use this in your form.

 Protected Overrides Function ProcessCmdKey(ByRef msg As Message, ByVal keyData As Keys) As Boolean

        Const WM_KEYDOWN As Integer = &H100

        Const WM_SYSKEYDOWN As Integer = &H104
 

        If ((msg.Msg = WM_KEYDOWN) Or (msg.Msg = WM_SYSKEYDOWN)) Then

            Select Case (keyData)

                Case Keys.A To Keys.Z                                '<--- Catch the Keys you want

                    MessageBox.Show("You pressed " & ChrW(keyData))  '<--- Then do something

                Case Keys.Right

                    Me.Text = "Right Arrow Captured"

                Case Keys.Left

                    Me.Text = "Left Arrow Captured"

                Case Keys.Down

                    Me.Text = "Down Arrow Captured"

                Case Keys.Up

                    Me.Text = "Up Arrow Captured"

                Case Keys.Tab

                    Me.Text = "Tab Key Captured"

                Case (Keys.Control Or Keys.A)

                    Me.Text = "<CTRL> + A Captured"

                Case (Keys.Alt Or Keys.Z)

                    Me.Text = "<ALT> + Z Captured"

                Case Keys.NumPad0

                    Me.Text = "Num Pad '0' Captured"

                Case Keys.Delete

                    MessageBox.Show("Delete Captured")

                Case Keys.NumLock

            End Select

        End If
 

        Return MyBase.ProcessCmdKey(msg, keyData)

    End Function

Open in new window

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

760 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

19 Experts available now in Live!

Get 1:1 Help Now