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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modal Forms

Status
Not open for further replies.

fergmj

Programmer
Feb 21, 2001
276
US
I have an app that looks like this:

Private Sub Form_Load()
Show 1 'setting the form as modal
SetFocus 'setting the focus to a text box on the form
EndSub

Here is the problem...

Once I declare the form as modal (Show 1) it never goes to the set focus step. It mves on the the rest of the script. If I unload the modal form, it then goes back to the line where I set the focus but obviously errors because it can't set the focus on something that I unloaded.

Any advice or tips?

Thanks
fergmj
 
Yes, even when you SHOW yourself, execution stops at the SHOW. Try setting FOCUS the FIRST TIME that the ACTIVATE EVENT occurs or set a TIMER for 55 milliseconds and the SETFOCUS. I ALWAYS use ON ERROR RESUME NEXT ONERROR GOTO 0 around a SETFOCUS.
As soon as you UNLOAD, HIDE or ME.VISIBLE=FALSE, execution begins again after the SHOW. MODAL Forms can be messy if they are not kept simple.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top