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. DataGridView and NextControl

DataGridView and NextControl

Scheduled Pinned Locked Moved C#
helpquestion
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.
  • A Offline
    A Offline
    aranhamarvel
    wrote on last edited by
    #1

    Good Morning, i have a problem! i have a form with a DataGrid. the form have a KeyPreview properties and i placed it to true. the form events "KeyPress" i placed the following code: if (e.KeyChar == (char)13) SendKeys.Send("{TAB}") so when i click on enter and the focus is on datagrid on the first row, so the focus goes to third row and not on second. what's the problem?? Thanks a lot!

    F 1 Reply Last reply
    0
    • A aranhamarvel

      Good Morning, i have a problem! i have a form with a DataGrid. the form have a KeyPreview properties and i placed it to true. the form events "KeyPress" i placed the following code: if (e.KeyChar == (char)13) SendKeys.Send("{TAB}") so when i click on enter and the focus is on datagrid on the first row, so the focus goes to third row and not on second. what's the problem?? Thanks a lot!

      F Offline
      F Offline
      freshonlineMax
      wrote on last edited by
      #2

      I think you don't need to capture Enter key in DataGridView. Because normally pressing Enter causes to focus goes to next line. For activating movement by "Enter" instead of "Tab" use below code : Form_KeyDown() { this.SelectNextControl(); } Don't forget to set all controls TabIndex property.

      A 1 Reply Last reply
      0
      • F freshonlineMax

        I think you don't need to capture Enter key in DataGridView. Because normally pressing Enter causes to focus goes to next line. For activating movement by "Enter" instead of "Tab" use below code : Form_KeyDown() { this.SelectNextControl(); } Don't forget to set all controls TabIndex property.

        A Offline
        A Offline
        aranhamarvel
        wrote on last edited by
        #3

        Thanks dude! i didn't know that DataGridView has this movement by "Enter" instead of "Tab", without need to use code. it was a good tip. Thank you a lot.

        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