Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Move out of field with Validation Event with mouse

Status
Not open for further replies.

jzelhart

Programmer
Feb 10, 2003
469
US
I have a field with a Validate Event that gives you an information only msgbox. The user clicks OK and should be able to move on. If they use the Tab button to move to the next field, this is not an issue. But if they use their mouse to click on another field, they can not type in that field. The validation event fires, the msgbox is opened, you click OK (or press enter key) and Focus is in the field that you clicked in, but you can not type anything.

You have to click into that field to be able to type.

It is like the Mouse Event was interupted. I looked on Microsoft and couldn't find anything. I have all of the Service Packs ran for VB 6.

Thanks for any help that you can give,

Jennifer
 
Hey,

Don't really have an answer, but if you are not relying on the functionality of the validate event to cancel the lost focus you may try moving your code to the LostFocus event. Just a though ... I hate to see these issues sit for a long time.

Also consider placing code in the gotfocus event of the control receiving focus to force it to accept keystrokes (i.e. selstart and sellength).

Good luck
KCI
 
Normally, you would have a message box only if the action is to be cancelled in the validation event.
It may be annoying for the users to do otherwise.
You may want to use a Status bar or info label instead.
 
I have come to find out this has to do with opening a Modal Form (which MsgBox is) I had tried to create my own msgbox form, thinking that this was affiliated with the MsgBox function, but I got the same results.

I think that I need to use the Validate Event. The way I have gotten around this, is to create a Frame with the message inside it. The focus is fine then.

CCLINT:

My users don't tend to look at the Status Bar - wish they did. I find this theory (info message box) annoying as well.

I basically created an Info Label inside of the frame.

I wish I had room on the form to keep a place for messages so that they wouldn't need to click the OK button to continue but... Real Estate is tight.

My thanks to both of you!
 
You could use a timed proceedure and just have the message box disappear after a few seconds.
 
That's true.

Thanks...

I think that I will do the OK button and the Timer. Just incase they are quicker than I am. :)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top