|
#1
|
|||
|
|||
|
Form Activeate event
I have a subrouting on one form (call it form A) that is showing another form (call it form B) using the frmB.Show method, and the form B will then show the form and exicute the form B initialize event when it shows but does not exicute the form B Activate event. That doent seem right to me, it seems like when you show a form you should get both the initialize event and the activate event, how am I thinking about this incorrectly?
|
|
#2
|
|||
|
|||
|
Okay, to understand the events better and the order in which these events occur, try this...
Code:
Option Explicit Private Sub Form_Activate() Debug.Print "Form_Activate" End Sub Private Sub Form_Deactivate() Debug.Print "Form_Deactivate" End Sub Private Sub Form_GotFocus() Debug.Print "Form_GotFocus" End Sub Private Sub Form_Initialize() Debug.Print "Form_Initialize" End Sub Private Sub Form_Load() Debug.Print "Form_Load" End Sub Private Sub Form_LostFocus() Debug.Print "Form_LostFocus" End Sub Private Sub Form_Paint() Debug.Print "Form_Paint" End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) Debug.Print "Form_QueryUnload" End Sub Private Sub Form_Resize() Debug.Print "Form_Resize" End Sub Private Sub Form_Terminate() Debug.Print "Form_Terminate" End Sub Private Sub Form_Unload(Cancel As Integer) Debug.Print "Form_Unload" End Sub Form_Initialize Form_Load Form_Resize Form_Activate Form_GotFocus Form_Paint Form_QueryUnload Form_Unload Form_Terminate Then from a form that shows another form (Form2.show) you get this, which is the same Form_Initialize Form_Load Form_Resize Form_Activate Form_GotFocus Form_Paint Form_QueryUnload Form_Unload Form_Terminate'however this event does not fire until the program ends Now, these are the results you get when you also switch focus between the two forms and use code to close the form with... Code:
Unload Form2 Set Form2 = Nothing Form_Load Form_Resize Form_Activate Form_GotFocus Form_Paint Form_LostFocus Form_Deactivate Form_Activate Form_GotFocus Form_LostFocus Form_Deactivate Form_QueryUnload Form_Unload Form_Terminate Hopes this helps... Good Luck |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Resize 4 textbox on form resize event (with the same size relation) | Alphadan | .NET | 2 | 07-27-2007 01:18 AM |
| how load UserControl into a Form via Event VB.Net | johnnyt | .NET | 2 | 03-26-2007 05:46 PM |
| Attatch a event function to an element | greffin | AJAX | 0 | 02-28-2007 06:46 AM |
| Custom Form Event | Shafiq | Enterprise | 1 | 04-12-2002 05:25 AM |
| How do I trapp Key-press event outside my form | sanjiv | VB Classic | 0 | 03-18-2000 04:00 AM |