mainman
09-08-2003, 08:01 PM
I have a problem: i show a form (the text box form for explanational purposes) and display the details which have been saved into an array and print them to text boxes, depending on which option button has been selected (1 to 52) on the previous form (the option button form. My problem is that all the text is being printed into the text boxes under form_load. When I go to select another option button and re-show the text box form, the Form_Load command does not execute.
How do I manually re-do Form_load?
MikeJ
09-08-2003, 08:32 PM
You can either move the code to another sub that you made, like Sub ThisSub (of course, you would need to call it whenever it is needed), or you can put the code in the GotFocus event of the form. However, if you use the GotFocus way, be advised that that event doesn't always fire when the form gets focus. I have seen instances where it won't fire.
~Mike
P.S.
Or you could unload the form, then reload it.
The problem lies in the fact that the form is already loaded. Executing the following code snippets are synonymous.
Form2.Show
Load Form2
Form2.Show
The reason for this is that when you access Form2 to execute the Show method, it implicitly loads the form. The Show method does not load the form, it simply makes the form visible.
Now, one solution is to have the option click event in your original form execute a method in Form2 to set the textboxes to whatever you would like. I would avoid relying on UI events such as GotFocus in the second form, as this can be triggered by other means than changing an option value. Like MikeJ said, you can always unload and reload the form, but that's a waste of resources. You should only unload a reload items from memory when necessary to avoid extra overhead.
--Van^