Solved

Form_Activate

Posted on 2000-05-04
12
923 Views
Last Modified: 2008-02-20
I am sure this is a simple question.  Can anyone tell me why the form_activate doesn't always work?  I have a form that performs a form1.show.  In form1, when closing, I perform an unload me.  If I attempt to go back into form1, the form_activate doesn't work.  Actually sometimes it doesn't work on the first trip into form1.  

Any advice would be appreciated.  
0
Comment
Question by:DebeG
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +3
12 Comments
 
LVL 6

Expert Comment

by:Marine
ID: 2778940
place a break point there and see what happends. Or step though your code by pressing F8
0
 
LVL 32

Expert Comment

by:bhess1
ID: 2778951
It may depend on your code, and what you are checking.  An Unload doesn't remove everything from memory (for that you need to set the Form to Nothing), so if you are checking a flag to determine if the Activate code has already run, you may not be getting the value in the flag that you would expect.
0
 
LVL 9

Expert Comment

by:GivenRandy
ID: 2778982
Can you paste your code here?  It should work (and does for me), but maybe you're doing something different.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 2779853
Form_Activate does only happen, if another (nonmodal) form in your application get's the focus.
The event is NOT fired when switching from your application to other and back.
The event is fired for MDIMain form when last MDIChild is closed.

if you need to check if form gets focus, you need API solution...

Hope this helps
0
 

Author Comment

by:DebeG
ID: 2780618
I don't have a good example of it.  I use the form_activate to load data into the form.  I have put breakpoints here and can see when performing a form1.show from formA, the form_activate in form1 doesn't trigger.  It does sometimes or most of the time work.  Like right now, I am debugging the code to determine what causes it to happen and form_activate occurs every time.  Yesterday it wasn't.  I just thought there was something about form_activate I didn't know about.  What causes it to trigger?

I thought it triggered everytime the form received focus.  Is that not correct?  
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 2780658
Maybe you should rather use Form_Load event to load your data initially.
Personnally, i only use the Activate Event when working with MDIChild forms
Good luck
0
 

Author Comment

by:DebeG
ID: 2781185
This question has a deletion request Pending
0
 
LVL 9

Expert Comment

by:GivenRandy
ID: 2781271
This question no longer is pending deletion
0
 
LVL 9

Expert Comment

by:GivenRandy
ID: 2781272
Why?  Sounds like it was answered by angelIII.
0
 
LVL 1

Accepted Solution

by:
Toad224 earned 50 total points
ID: 2784907
ok...  Form_Activate is usually used when using a MDI.  However... It is also called when a another form in your project is activated, and then you activate your form.  It is not called when another program is activated, and then your form is activated.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 2785255
You are repeating my comment, Toad224
0
 
LVL 1

Expert Comment

by:Toad224
ID: 3232812
Sorry, I didn't read the comments
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
TT Auto Dashboard 13 104
Send outlook email from VBS Script 2 67
Fastest way to find and count same items VB6 16 62
Access2016 ignore hyphen in data entry or searches 5 70
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question