• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 229
  • Last Modified:

lost focus problem

is there a way to know what caused the lost focus of a field ( for example : move to another field, press on a bottun, go to an event ... etc )
i need it in order to check the field validation for each case exept when the user press the exit application button/event
0
yaelt
Asked:
yaelt
  • 2
  • 2
  • 2
1 Solution
 
DavidMartinCommented:
Move the code from the click event on the Exit button to the MouseDown event on the Exit button.
0
 
apratimaCommented:
I have a perfect solution for it.
In the LostFocus event of that control you should add some code like this
   If Form1.ActiveControl.Name = "cmdExit"
       Exit sub
   End If
   ********* Code for validation *************
Name propery will not be there at design time. So don't worry if after pressing . you see no popup.
I assumed that cmdExit is Name of your Exit button, and Form1 is your current form name.


0
 
yaeltAuthor Commented:
thanks ! but i still have trouble when i m activating the exit button with a short cut key ( like alt+e 4 example )
how can i prevent the validation check then ?
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
DavidMartinCommented:
Have you tried apratima answer?

This should solve it.
0
 
yaeltAuthor Commented:
this comment is 4 apratima :
your answer is correct! but inorder to give u the points,please comment this qst again ( cause now i can accept only the last anser )

0
 
apratimaCommented:
Thanks for the points
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now