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. Visual Basic
  4. EASY SIMPLE, Never done keypress, help....

EASY SIMPLE, Never done keypress, help....

Scheduled Pinned Locked Moved Visual Basic
csharphelp
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.
  • J Offline
    J Offline
    Joey Picerno
    wrote on last edited by
    #1

    vb.net 2005 I have one textbox. I want to enter a string and run my addrecord sub when I press enter. Something ive never learned that Im sure is very simple. Someone give me some code, thank you guys/girls!!!

    N 1 Reply Last reply
    0
    • J Joey Picerno

      vb.net 2005 I have one textbox. I want to enter a string and run my addrecord sub when I press enter. Something ive never learned that Im sure is very simple. Someone give me some code, thank you guys/girls!!!

      N Offline
      N Offline
      nlarson11
      wrote on last edited by
      #2

      To teach your self start out with what is available to you. The keypress event has 2 arguments. The sender and the e. Well you know who the sender is...the text box. well what's e? inside the routine, press e and then the period. you get options of what's available to you. you'll see a property called 'keychar'. that is the character representation of what you pressed. well what are you looking for? the return key. so test for it. Private Sub txt_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txt.KeyPress if e.keychar = controlchars.cr then 'run any code you want... end if End Sub

      J 1 Reply Last reply
      0
      • N nlarson11

        To teach your self start out with what is available to you. The keypress event has 2 arguments. The sender and the e. Well you know who the sender is...the text box. well what's e? inside the routine, press e and then the period. you get options of what's available to you. you'll see a property called 'keychar'. that is the character representation of what you pressed. well what are you looking for? the return key. so test for it. Private Sub txt_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txt.KeyPress if e.keychar = controlchars.cr then 'run any code you want... end if End Sub

        J Offline
        J Offline
        Joey Picerno
        wrote on last edited by
        #3

        It works, thank you for your help....

        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