Focus Question

I have a panel that has a lot of diffrent input type controls (text boxes, labels, numericupdown, and such). I also have a listbox that is not on the panel. There is also A LOT of other controls all over the form. What I want is to execute a query to store the information into the database whenever the focus is NOT on one of the controls in the panel.... How do I do that?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Use the Leave() event. For example, with Panel1:

    Private Sub Panel1_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Panel1.Leave
        Debug.WriteLine("You are leaving this panel")
    End Sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
I think I misread your question. It should be more like this:

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If Me.ActiveControl.Parent Is Panel1 Then
            Debug.WriteLine(Now & " : panel has focus")
            Debug.WriteLine(Now & " : panel does not have focus")
        End If
    End Sub
Gunit2507Author Commented:
Your first answer is what I was looking for.... Thanks a lot for the help!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.