Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Detecting Cancel Button
Message
 
To
14/01/2002 06:22:20
Peter Walburn
Omega Data Services Ltd
Aberdeen, United Kingdom
General information
Forum:
Visual Basic
Category:
Other
Miscellaneous
Thread ID:
00604194
Message ID:
00604224
Views:
29
This message has been marked as the solution to the initial question of the thread.
>Hello,
>
>In a VB 6 application that I am writing, I have code in a LostFocus of a text box control which checks to see that the entry is valid. This code works well, but I now have a problem. If the user enters any text and then presses Cancel, then the code to check if the entry is valid is not needed. So I need a way in the LostFocus event to check if the control that has been pressed (causing the LostFocus event to be called) is the Cancel button. If it is Cancel then I don't need to run the validation code.

You can check the active control:
Private Sub Text1_LostFocus()
    If Screen.ActiveControl.Name = "cmdCancel" Then Exit Sub
    
    'Other validations here
End Sub
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform