0

I have a simple winforms app that has a couple of buttons and a listbox. It does not have menus.

I would like to handle the select-all action, control-A. Is there a way to do that at the form level even if the listbox isn't focused, and even without menus?

I've solved this by putting an invisible button called "&All" on the form, but I'm wondering if there is a more-canonical solution?

Maury Markowitz
  • 9,082
  • 11
  • 46
  • 98
  • 1
    Have you looked at [this answer](https://stackoverflow.com/a/400325/424129)? – 15ee8f99-57ff-4f92-890c-b56153 Jun 16 '17 at 16:38
  • 1
    I marked this as a duplicate of a canonical WinForms question, but the code there is in C#. You should be able to trivially translate the ideas into VB.NET syntax, but if you need help, you can run it through an online converter. Or [edit] this question to ask about what you're confused about. – Cody Gray - on strike Jun 16 '17 at 16:38
  • [this one might get you closer](https://stackoverflow.com/questions/18282303/how-to-catch-ctrl-alt-rshftkey) In your case, I think all you need to start with is, `If e.KeyValue = Keys.ControlKey And e.KeyValue = Keys.A Then` – Jimmy Smith Jun 16 '17 at 16:40
  • This is indeed a duplicate, feel free to close. Or do I do that? – Maury Markowitz Jun 16 '17 at 20:27
  • Already closed. You don't have to do anything. Glad this worked for you. – Cody Gray - on strike Jun 17 '17 at 11:06

0 Answers0