Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Detecting Cancel Button
Message
 
À
14/01/2002 06:22:20
Peter Walburn
Omega Data Services Ltd
Aberdeen, Royaume Uni
Information générale
Forum:
Visual Basic
Catégorie:
Autre
Divers
Thread ID:
00604194
Message ID:
00604224
Vues:
23
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform