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. C#
  4. Datagridview cursor focus

Datagridview cursor focus

Scheduled Pinned Locked Moved C#
help
4 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
    praveenkumar palla
    wrote on last edited by
    #1

    My requirement is on button click the cursor should be focused in the particular cell of the datagridview control. Presently on button click i am selecting the required cell and when i click on that cell the cursor is focusing to that cell..... but i need this focus should be on button click itself. Please help me on this Thancks in advance PraveenKumar Palla

    J 1 Reply Last reply
    0
    • P praveenkumar palla

      My requirement is on button click the cursor should be focused in the particular cell of the datagridview control. Presently on button click i am selecting the required cell and when i click on that cell the cursor is focusing to that cell..... but i need this focus should be on button click itself. Please help me on this Thancks in advance PraveenKumar Palla

      J Offline
      J Offline
      Judah Gabriel Himango
      wrote on last edited by
      #2

      So you want to position the cursor over a particular cell? Have you tried getting the cell coordinates in screen coordinates and then call Cursor.SetPosition? (this is all assuming you're using Windows Forms, not some web-based grid)

      Tech, life, family, faith: Give me a visit. I'm currently blogging about: Minnesota Bridge Collapses The apostle Paul, modernly speaking: Epistles of Paul Judah Himango

      P 1 Reply Last reply
      0
      • J Judah Gabriel Himango

        So you want to position the cursor over a particular cell? Have you tried getting the cell coordinates in screen coordinates and then call Cursor.SetPosition? (this is all assuming you're using Windows Forms, not some web-based grid)

        Tech, life, family, faith: Give me a visit. I'm currently blogging about: Minnesota Bridge Collapses The apostle Paul, modernly speaking: Epistles of Paul Judah Himango

        P Offline
        P Offline
        praveenkumar palla
        wrote on last edited by
        #3

        thanks for the soon reply there is no property "cursor.setposition" "cursor.current" is there i tried like dgvlasers.cursor=cursor.current; but no use; so help me on this.

        J 1 Reply Last reply
        0
        • P praveenkumar palla

          thanks for the soon reply there is no property "cursor.setposition" "cursor.current" is there i tried like dgvlasers.cursor=cursor.current; but no use; so help me on this.

          J Offline
          J Offline
          Judah Gabriel Himango
          wrote on last edited by
          #4

          // Get the location location of the cell we're interested in (pretend it's row[0].cell[0]
          Point cellLocation = dgvlasers.Rows[0].Cells[0].ContentBounds.Location;

          // Convert that to screen coordinates.
          Point cellLocationInScreenCoordinates = dgvlasers.PointToScreen(cellLocation);

          // Set the cursor position.
          Cursor.Position = cellLocationInScreenCoordinates;

          Tech, life, family, faith: Give me a visit. I'm currently blogging about: Minnesota Bridge Collapses The apostle Paul, modernly speaking: Epistles of Paul Judah Himango

          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