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. shifting focus from datagrids

shifting focus from datagrids

Scheduled Pinned Locked Moved Visual Basic
help
2 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.
  • P Offline
    P Offline
    Paps2
    wrote on last edited by
    #1

    Hi, I would like to use the F1 and F2 key to set the focus between 2 grids in the form. Lets say the cursor focus is in DBgrid1, on hitting F1 I want the focus to shift to Dbgrid2. And again on hiting F2 I want the focus to go back to DBgrid1. Here is a piece of my code but wont work. It does not give me an error mssg but wont fire. If I change it to DbGrid2.Focus = True then I get an error mssg. Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown If e.KeyCode = Keys.F2 Then DBGrid2.Item(0, 0).Focus = True 'Dbgrid2.Focus = True End If End Sub

    A 1 Reply Last reply
    0
    • P Paps2

      Hi, I would like to use the F1 and F2 key to set the focus between 2 grids in the form. Lets say the cursor focus is in DBgrid1, on hitting F1 I want the focus to shift to Dbgrid2. And again on hiting F2 I want the focus to go back to DBgrid1. Here is a piece of my code but wont work. It does not give me an error mssg but wont fire. If I change it to DbGrid2.Focus = True then I get an error mssg. Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown If e.KeyCode = Keys.F2 Then DBGrid2.Item(0, 0).Focus = True 'Dbgrid2.Focus = True End If End Sub

      A Offline
      A Offline
      Anonymous
      wrote on last edited by
      #2

      try uncommending 'Dbgrid2.Focus = True or using enabled or visible instead. They may accomplish somthing acceptable without the fuss

      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