Top DevX Stories
Creating Custom Export Filters for StarOffice with XSLT
WPF Wonders: Using DataTemplates
Crystal Reports Family Offers Options for Developers
Avaya Aura Session Manager video
Avaya Aura Overview video
Search the forums:

Go Back   DevX.com Forums > DevX Developer Forums > VB Classic

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 10-29-2009, 05:20 PM
AM003295 AM003295 is offline
Registered User
 
Join Date: Nov 2004
Posts: 244
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?
Reply With Quote
  #2  
Old 10-30-2009, 01:42 AM
vb5prgrmr vb5prgrmr is offline
Registered User
 
Join Date: Jun 2009
Posts: 46
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
Which with a stand alone form you get these results...

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_Initialize
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
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

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


All times are GMT -4. The time now is 12:13 AM.


Sponsored Links



Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.