Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Trapping arrow keys in form

Trapping arrow keys in form

Scheduled Pinned Locked Moved C#
csharpdatabasedotnetvisual-studiohelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kaikus
    wrote on last edited by
    #1

    Hi! I've read arrow kay can only be intercepted by using KeyUp event. KeyPress only works with characters, and KeyDown allows Control Keys, too, but not arrow keys. I have tried, and KeyUp works well... but only if i have no other controls in the form! If I have any control enabled and focussed, I can't trap KeyUp Form evnent... I suppose the focussed control traps it. I have Visual Studio 2003, so I only can use .NET Framework 1 available (or so I have been told). I'm proggramming a simple form that allow me to brouse data fron a database, and I don't have access to this nice BindingNavigator control. So, I have created the form, binded controls, and created the First, Last, Prev, Next buttons to manage my CurrencyManager. It works fine, but I want to be able to browse just using my arrow keys. I think that trap arrow keys ON EVERY active controls in my form is a very poor solution... Any help, please? :)

    realJSOPR 1 Reply Last reply
    0
    • K Kaikus

      Hi! I've read arrow kay can only be intercepted by using KeyUp event. KeyPress only works with characters, and KeyDown allows Control Keys, too, but not arrow keys. I have tried, and KeyUp works well... but only if i have no other controls in the form! If I have any control enabled and focussed, I can't trap KeyUp Form evnent... I suppose the focussed control traps it. I have Visual Studio 2003, so I only can use .NET Framework 1 available (or so I have been told). I'm proggramming a simple form that allow me to brouse data fron a database, and I don't have access to this nice BindingNavigator control. So, I have created the form, binded controls, and created the First, Last, Prev, Next buttons to manage my CurrencyManager. It works fine, but I want to be able to browse just using my arrow keys. I think that trap arrow keys ON EVERY active controls in my form is a very poor solution... Any help, please? :)

      realJSOPR Offline
      realJSOPR Offline
      realJSOP
      wrote on last edited by
      #2

      http://support.microsoft.com/?id=320584[^] Evidently, you have to override ProcessCmdKey BTW, google is your friend...

      .45 ACP - because shooting twice is just silly
      -----
      "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
      -----
      "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

      K 1 Reply Last reply
      0
      • realJSOPR realJSOP

        http://support.microsoft.com/?id=320584[^] Evidently, you have to override ProcessCmdKey BTW, google is your friend...

        .45 ACP - because shooting twice is just silly
        -----
        "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
        -----
        "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

        K Offline
        K Offline
        Kaikus
        wrote on last edited by
        #3

        Thanks! In fact, just a few minutes ago, I had found this same article (google is your really 'very best' friend), and I was going to post the solution for any people who needed it. This, combined with myButton.PerformClick(), is the complete solution I needed. Thanks for your very quick reply!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups