Solved

LostFocus

Posted on 1998-03-21
2
574 Views
Last Modified: 2008-03-17
When moving from one MDI-child to another i don´t want some LostFocus events to be fired. I use the    
=> If Screen.ActiveForm.hWnd <> Me.hWnd Then Exit Sub
on some controls but how to do this i i have a ActiveX-Control in a MDI-Child and the ActiveX-Control contins a grid where i don´t want the SS_LeaveCell event to be fired.

I have try with this sample but the Screen.ActiveForm is not set when I am in the grid in the ActiveX-Control.

Private Sub SS_LeaveCell(ByVal Col As Long, ByVal Row As Long, ByVal NewCol As Long, ByVal NewRow As Long, Cancel As Boolean)

    If UserControl.Parent.hWnd <> Screen.ActiveForm.hWnd Then Exit Sub
    'My other code after this....
      
End Sub
0
Comment
Question by:jannea
2 Comments
 

Accepted Solution

by:
Acid_Buzz earned 50 total points
ID: 1459537
Try to use a boolean property, replacing Scree.ActiveForm.. set it to true when form gotfocus or form is activate and false when form lost focus.. this is more easy to know how the form is activate..
0
 
LVL 1

Author Comment

by:jannea
ID: 1459538
Sorry Buzz, I´ll been gone for a while...

OK but, how to from my OCX find out the hWnd of the form who´s contain my OCX, that´s my mainproblem...
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now