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

How can Me.SetFocus give me inv proc call/arg? 1

Status
Not open for further replies.

smithles

Programmer
Jul 15, 2002
18
0
0
in "main" (VB 6, prog prev ran in VB4)

Load frmsearch 'this was the original les 11/10/02
NOTE execution continues here if the error in frmsearch is ignored
. . .

VERSION 5.00
Begin VB.Form frmsearch
. . . various buttons etc

Private Sub Form_Activate()
Dim tmpr%
On Error GoTo actvateSearch_err
Me.WindowState = 2
' next statement crashes the prog 10/10/02 2220
Me.SetFocus
Exit Sub
actvateSearch_err:
panic Err, "ActivateSearch err"
Exit Sub

End Sub

 
The activate event can occur before the form is visible. When you try to setfocus to it (or a control on it), it's unable to do that because there's nothing to show.

Basically, don't use the activate event unless you really have to.

Chip H.
 
HI.
Thanks chiph. I have gone past the crash, but theform still doesn't display, execution now follows completion of the activate. I will follow through as I had not understood that before and will study further before reposting.
Les
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top