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
  1. Home
  2. General Programming
  3. Visual Basic
  4. KeyStorke

KeyStorke

Scheduled Pinned Locked Moved Visual Basic
tutorial
4 Posts 4 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
    Karma31251
    wrote on last edited by
    #1

    I cant seem to remember how to record keystrokes. Basically i need to use the keystroke value in an IF Statement to say, if back or delete were pressed then end if thanks in advance Karma

    M K J 3 Replies Last reply
    0
    • K Karma31251

      I cant seem to remember how to record keystrokes. Basically i need to use the keystroke value in an IF Statement to say, if back or delete were pressed then end if thanks in advance Karma

      M Offline
      M Offline
      Marcus J Smith
      wrote on last edited by
      #2

      The windows form as a KeyPress event that you can look at to retrieve the keystroke.


      CleAkO

      "I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy
      "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)

      1 Reply Last reply
      0
      • K Karma31251

        I cant seem to remember how to record keystrokes. Basically i need to use the keystroke value in an IF Statement to say, if back or delete were pressed then end if thanks in advance Karma

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

        Here is some code that should work for you... Private Sub yourtextbox_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles yourtextbox.KeyDown 'Only allow some control keys If e.KeyValue = Keys.Delete OrElse e.KeyValue = Keys.Back Then 'good key press Else e.Handled = True End If End Sub Hope that helps. Ben

        1 Reply Last reply
        0
        • K Karma31251

          I cant seem to remember how to record keystrokes. Basically i need to use the keystroke value in an IF Statement to say, if back or delete were pressed then end if thanks in advance Karma

          J Offline
          J Offline
          JustmeNick
          wrote on last edited by
          #4

          use the key down event handler as below Private Sub txtTendered_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtTendered.KeyDown If e.KeyCode = Keys.delete Then do something here elseif e.keycode = keys.enter then do something else end if end sub hope this helps

          Nab

          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