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 to identify active control on a form [modified]

How to identify active control on a form [modified]

Scheduled Pinned Locked Moved C#
questioncsharpvisual-studiotutorial
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.
  • D Offline
    D Offline
    dennisd45
    wrote on last edited by
    #1

    Hello, The users require a shortcut key to allow them to navigate from one groupbox to the next. I am catching the key press event in the forms base class. The group boxes that will be available for navigation are in an arraylist that is available to the base class. How can I determine which groupbox is currently active? I tried the Focused property, but it always returns false. I have looped through each groupbox's Controls collection, and tested the Focused property of each control, but they all return false as well. Is there any method or property that I can use to determine the active control? Or will I need to do this manually? -- modified at 13:01 Monday 7th August, 2006 I am using C#, VS 2003.

    J 1 Reply Last reply
    0
    • D dennisd45

      Hello, The users require a shortcut key to allow them to navigate from one groupbox to the next. I am catching the key press event in the forms base class. The group boxes that will be available for navigation are in an arraylist that is available to the base class. How can I determine which groupbox is currently active? I tried the Focused property, but it always returns false. I have looped through each groupbox's Controls collection, and tested the Focused property of each control, but they all return false as well. Is there any method or property that I can use to determine the active control? Or will I need to do this manually? -- modified at 13:01 Monday 7th August, 2006 I am using C#, VS 2003.

      J Offline
      J Offline
      Josh Smith
      wrote on last edited by
      #2

      I believe that the static Form.ActiveControl property is what you need.

      :josh: My WPF Blog[^]

      D 1 Reply Last reply
      0
      • J Josh Smith

        I believe that the static Form.ActiveControl property is what you need.

        :josh: My WPF Blog[^]

        D Offline
        D Offline
        dennisd45
        wrote on last edited by
        #3

        Thank you, that gets the job done. BTW it is an instance, not static, property.

        No eternal reward will forgive us now for wasting the dawn. - Jim Morrison

        J 1 Reply Last reply
        0
        • D dennisd45

          Thank you, that gets the job done. BTW it is an instance, not static, property.

          No eternal reward will forgive us now for wasting the dawn. - Jim Morrison

          J Offline
          J Offline
          Josh Smith
          wrote on last edited by
          #4

          dennisd45 wrote:

          BTW it is an instance, not static, property.

          Doh! Of course, it doesn't make sense for it to be static. Sorry about that. :doh:

          :josh: My WPF Blog[^]

          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