Results 1 to 2 of 2

Thread: Detect current active components? [Resolved]

  1. #1

    Thread Starter
    Registered User
    Join Date
    Apr 2003
    Location
    Klang, Selangor, Malaysia
    Posts
    163

    Question Detect current active components? [Resolved]

    I have 2 components: a TreeView and a ListBox in a form.

    How can I detect (using VB .NET code)which component is the one I'm currently working on?

    Please guide. Thank you.
    Last edited by albertlse; Aug 21st, 2003 at 08:35 PM.

  2. #2
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    The code is in C#, so if you need help converting it, let me know:

    Code:
    private void button1_Click(object sender, System.EventArgs e) {
        foreach (Control c in this.Controls) {
            if (c.Focused) {
                MessageBox.Show("Name: " + c.Name + " Has Focus.");
                return;
            }
        }
    }

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