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. C#
  4. moving in windows form by keyboard ENTER key

moving in windows form by keyboard ENTER key

Scheduled Pinned Locked Moved C#
helptutorialquestion
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.
  • S Offline
    S Offline
    sachees123
    wrote on last edited by
    #1

    frnds, how to move focus of one component(textbox, date picker, combo...) to other component. with ENTER key? i tried key press with ..... code private void txtAppfrmNo_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if (e.KeyChar == (char)13) { MessageBox.Show("to next box"); } } ****************************************************************** this.txtAppfrmNo.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtAppfrmNo_KeyPress); **************************************************** its not working, where is the problem???

    L OriginalGriffO G 3 Replies Last reply
    0
    • S sachees123

      frnds, how to move focus of one component(textbox, date picker, combo...) to other component. with ENTER key? i tried key press with ..... code private void txtAppfrmNo_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if (e.KeyChar == (char)13) { MessageBox.Show("to next box"); } } ****************************************************************** this.txtAppfrmNo.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtAppfrmNo_KeyPress); **************************************************** its not working, where is the problem???

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Why not Keys.Enter? Check out the documentation[^] on the Keys Enumeration.

      Check out the CodeProject forum Guidelines[^] The original soapbox 1.0 is back![^]

      1 Reply Last reply
      0
      • S sachees123

        frnds, how to move focus of one component(textbox, date picker, combo...) to other component. with ENTER key? i tried key press with ..... code private void txtAppfrmNo_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if (e.KeyChar == (char)13) { MessageBox.Show("to next box"); } } ****************************************************************** this.txtAppfrmNo.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtAppfrmNo_KeyPress); **************************************************** its not working, where is the problem???

        OriginalGriffO Offline
        OriginalGriffO Offline
        OriginalGriff
        wrote on last edited by
        #3

        Plus that is pretty non-standard - Enter works the default key, normally OK. Why not use TAB like almost every other windows app since V2.0? Standards, dontcha jest lurve em?

        No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones

        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
        "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

        1 Reply Last reply
        0
        • S sachees123

          frnds, how to move focus of one component(textbox, date picker, combo...) to other component. with ENTER key? i tried key press with ..... code private void txtAppfrmNo_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if (e.KeyChar == (char)13) { MessageBox.Show("to next box"); } } ****************************************************************** this.txtAppfrmNo.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtAppfrmNo_KeyPress); **************************************************** its not working, where is the problem???

          G Offline
          G Offline
          Gary Stafford
          wrote on last edited by
          #4

          I agree with first two answers. Does it have to be the Enter key? Using the Tab key with TabIndex to indicate a specific indexing of controls is easier and more standard. Enter will cause a Submit on the form?

          Regards, Gary

          modified on Tuesday, June 23, 2009 9:21 PM

          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