By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,905 Members | 1,783 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,905 IT Pros & Developers. It's quick & easy.

Form Load does not trigger

100+
P: 134
Hi, I am new to vb6.
I have some code written in the form load. the first time when I call the form, the code inside form load will activate.
After I have complete the form and return to main menu, the 2nd time when I call the form, it does not trigger the code in the form load, I put a debugging point on the code in the form load, but it not trigger, any idea what wrong ?
Jul 10 '08 #1
Share this Question
Share on Google+
3 Replies


debasisdas
Expert 5K+
P: 8,127
kindly post your code here for reference of our experts.
Jul 11 '08 #2

P: 28
Hi,
Seeing your code would have helped. I think you problem is that:
PROBLEM:
form_load() event is triggered only when the form is brought into memory(RAM) from the hard disk, where it exists as a file. So, when you 'switch back' to the form (e.g. by ALT-TAB), then this event is not raised.
SOLUTION1 :
put the code from form_load() to the Form_Activate() event of the form. This event is triggered when you 'activate' the form by ALT-TAB or mouse click etc.
SOLUTION2 :
This is bit less practical, and I would suggest to stick to previous solution.
Unload the form(CODE : Unload Form) when you switch to the other form, and load (CODE: Load Form) when you switch back to the previous one. In this way, the form_Load() event will be triggered again.

Think that should solve your problem, if I understood it right.

Bye.
Jul 12 '08 #3

P: 2
I don't know how you have left the form, but if it is using the "Form.hide" command, this means that the form is still loaded, and when you come back to it, the program believes it has already done what you wanted. If this is the case, use "Unload Form1" instead of "Form.Hide".
Jul 15 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.