|
-
Oct 17th, 2006, 03:49 AM
#1
Thread Starter
Frenzied Member
Can't Step to Form_Activate
When I debug the app with F5, Form_Load and Form_Activate get called just fine.
However, when I step through the code with F8, Form_Activate doesn't get called.
I load my form with Form2.Show
Last edited by agmorgan; Oct 17th, 2006 at 04:08 AM.
-
Oct 17th, 2006, 04:15 AM
#2
Re: Can't Step to Form_Activate
don't put any break points in your Form_Load, only in Form_Active.
-
Oct 17th, 2006, 07:17 AM
#3
Re: Can't Step to Form_Activate
 Originally Posted by agmorgan
When I debug the app with F5, Form_Load and Form_Activate get called just fine.
However, when I step through the code with F8, Form_Activate doesn't get called.
I load my form with Form2.Show
Yes, you are right.
For everyone else, try this experiment.
Open up a new standard exe project and add a second form to the default Form1.
One Form2, add the following code:
VB Code:
Private Sub Form_Activate()
MsgBox "Activate"
End Sub
Private Sub Form_Initialize()
MsgBox "Initialize"
End Sub
Private Sub Form_Load()
MsgBox "Load"
End Sub
On Form1 put a command button with Form2.Show in its click event; run it; click on Command1. You will see all three message boxes in the following order: Initalize - Load - Activate
Now, on Form2, but a break on Initialize, and "walk" through the process. After the messageboxs for Initialize and Load appear, you will be taken to the "End Sub" of Command1_Click on Form1, and you won't see the messagebox for Activate on Form2.
The Activate event ONLY fires when the Form is the Active Window. It will not be the Active Window when you step through the code because the focus will return to the calling form. When you do not step through it, and allow the form to load normally, form2 will become the active window thus firing the Activate event.
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
|