Results 1 to 2 of 2

Thread: How does WinForms label control handle focus?

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2007
    Posts
    36

    Question How does WinForms label control handle focus?

    Folks,

    There is a panel which contains 2 components: a label and a TreeView. The hierarchy, obviously, looks like this:

    Code:
    panel1  // handles Enter event
       - label1
       - treeView1
    I need to do some UI updates when user starts interacting with any of these 3 controls. My attempted strategy was to catch the Enter event of the panel, which would fire when user clicks a label, or TreeView. This way, I can write only one (1) event handler instead of several. While it worked for the TreeView, it didn't work for the label. When I click the label, I don't get the Enter event on the panel. What’s different about the label control?

    I could handle the Click event of the label. At the same time, I wonder what the other solutions might be.

    Any suggestion, insight or reference is really appreciated!

    - Nick

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How does WinForms label control handle focus?

    A Label can't receive focus, therefore clicking it won't cause the mouse to enter its parent.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width