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. How can you tell if an element in a datagrid has the focus?

How can you tell if an element in a datagrid has the focus?

Scheduled Pinned Locked Moved C#
csharpwinformshelptutorialquestion
2 Posts 1 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.
  • W Offline
    W Offline
    work_to_live
    wrote on last edited by
    #1

    I have a form with a number of user controls each derived from datagrid. I can't figure out how to tell which user control datagrid has the focus! I tried UserControl.Focused, and it returns false even if I select a cell within the datagrid. I tried overriding the UserControl.Focused property, extending the DataGrid.Focused value, and still no luck. I'm relatively new to C#, so it's probably something simple related to derived controls. Help!

    W 1 Reply Last reply
    0
    • W work_to_live

      I have a form with a number of user controls each derived from datagrid. I can't figure out how to tell which user control datagrid has the focus! I tried UserControl.Focused, and it returns false even if I select a cell within the datagrid. I tried overriding the UserControl.Focused property, extending the DataGrid.Focused value, and still no luck. I'm relatively new to C#, so it's probably something simple related to derived controls. Help!

      W Offline
      W Offline
      work_to_live
      wrote on last edited by
      #2

      Got it... ContainsFocus indicates whether the control or any of it's children controls has the focus.

      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