|
-
Dec 22nd, 2006, 10:47 AM
#1
Thread Starter
Hyperactive Member
Validate event with menu
Hi Everybody !
Is it normal that the validate event is not fired when I click in menu ???
Thanks in advance !
Note: NEVER USE SSTAB ! I LOST 2 HOURS TO REPLACE IT BY TABSTRIP !
DubweiserTM

If your question has been answered, you can mark a thread as resolved...
-
Dec 22nd, 2006, 10:52 AM
#2
Re: Validate event with menu
Yes, the focus doesn't leave the control when you go to a menu. Focus only escapes to other controls on the form; a menu isn't counted as a regular control in this case, it isn't within the same container as the other controls.
For a quick test:
VB Code:
Private Sub Text1_GotFocus()
Debug.Print "GotFocus"
End Sub
Private Sub Text1_LostFocus()
Debug.Print "LostFocus"
End Sub
Private Sub Text1_Validate(Cancel As Boolean)
Debug.Print "Validate"
End Sub
-
Dec 22nd, 2006, 11:03 AM
#3
Thread Starter
Hyperactive Member
Re: Validate event with menu
Ok ! The problem I have it's:
1) I Click in Textbox
2) I Erase text into it
3) I Click on menu "Close Project"
4) The programm ask if the user wants to save or no, if its yes I got an error because de Textbox is empty, and I need the value in the Textbox...
Suggestion ??? Thanks !
DubweiserTM

If your question has been answered, you can mark a thread as resolved...
-
Dec 22nd, 2006, 11:33 AM
#4
Re: Validate event with menu
Call the Form's ValidateControls method in the Menu Click event. You will need to setup error handling as ValidateControls raises an error if the control fails validation.
Why? I use it all the time. Never had any problems.
-
Dec 22nd, 2006, 11:40 AM
#5
Thread Starter
Hyperactive Member
Re: Validate event with menu
Thanks for your suggestions !
 Originally Posted by brucevde
Why? I use it all the time. Never had any problems.
You can check this link to understand why...
DubweiserTM

If your question has been answered, you can mark a thread as resolved...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|