|
-
Jun 15th, 2002, 02:00 PM
#1
Thread Starter
Lively Member
Probem with Unloading forms...<resolved!>
hey, im having a problem with the unloading of forms. For my project, its a fishing game and when you acheive a certain amount of points you move onto the next level (and next form). So in the point sub, when you reach this amount, it unloads the current form and loads the next one. THe problem is, when I unload the form and load the next form, it starts up the Form_Load event of the form it just unloaded! How can I unload it properly so it doesnt trigger the Form_Load event
Incase you dont get understand what i mean:
Form1 loads up from the start. When you reach 1000 points Form1 unloads and disapears and Form2 loads up. However, while Form2 is loading up, it triggers Form1's Form_Load event for some reason. I checked in everything to make sure I dont have a Form1.load event that I overlooked.
Is this suposed to happen maybe? Im a novice, so bear with me. Thanks.
~INNO~
Last edited by Inno; Jun 15th, 2002 at 03:44 PM.
-
Jun 15th, 2002, 02:10 PM
#2
Fanatic Member
a reason that it does that is maybe that u r checking properties of form1 from within form2. Say u have a control called cr in form1 if u check a property of cr from within form2 form1 will load again
e.g if u check debug.print cr.name from form2
-
Jun 15th, 2002, 02:11 PM
#3
Hyperactive Member
make sure you have STOPPED any loops you may have.
you can do something like this,
private stoploop as boolean 'defaults to false
inside your loop:
If StopLoop = True then exit sub
inside your form_queryunload (or form_unload)
StopLoop = True
form2.show
unload me
-
Jun 15th, 2002, 02:16 PM
#4
Hyperactive Member
Are you sure it's the load event and not the activation or other event? Anyway
try showing the next form before unloading the current:
Code:
Form2.Show
Unload Form1
Sometimes what you're looking for is exactly where you left it.
-
Jun 15th, 2002, 02:24 PM
#5
The picture isn't missing
Originally posted by tina104291325
a reason that it does that is maybe that u r checking properties of form1 from within form2. Say u have a control called cr in form1 if u check a property of cr from within form2 form1 will load again
e.g if u check debug.print cr.name from form2
thats the biggest possibility. calling ANYTHING (properties, controls, variables, sub, functions) will load the form if it isnt already loaded. you will probably need to store information in modules, or you could unload form1 in form2 when it loads, after you have got the info you need from form1 and no longer need anything from form1
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Jun 15th, 2002, 02:39 PM
#6
Thread Starter
Lively Member
Hm, thanks for the fast replies,
I have checked on everything you guys suggested.
Tina - No, nothing in that form is being checked from within another form
prog - I dont have loops, I dont even know how to work them yet :P
John - Yes, the load event is activating even after the unload. And yes, I have it show the form before I unload the previous one.
So, maybe I am overlooking something. If one of you guys wouldnt mind downloading the attached, that would be great. I just included the 2 forms that are conflicting. Run the project, Click the grey command button at the left of the screen (that will give u the points needed to pass the level instead of making u try and beat it =) ) then you will notice the msgbox that first appears at the begining gets repeated on the next form =/ Thanks for the help. Oh and also, can you tell me why the total score on the endscreen isnt adding up right. Thanks.
-
Jun 15th, 2002, 02:40 PM
#7
Need-a-life Member
Originally posted by BuggyProgrammer
thats the biggest possibility. calling ANYTHING (properties, controls, variables, sub, functions) will load the form if it isnt already loaded. you will probably need to store information in modules, or you could unload form1 in form2 when it loads, after you have got the info you need from form1 and no longer need anything from form1
Form's public properties won't load a form.
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Jun 15th, 2002, 02:45 PM
#8
The picture isn't missing
hey it was a logical guess
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Jun 15th, 2002, 02:45 PM
#9
-
Jun 15th, 2002, 02:47 PM
#10
Thread Starter
Lively Member
Form1 is really Form8
FOrm2 is really Endscreen
I just used those 2 for examples...
or did u mean something isnt working because there isnt a form1?
I can post my whole project if needed...
-
Jun 15th, 2002, 02:52 PM
#11
-
Jun 15th, 2002, 02:53 PM
#12
-
Jun 15th, 2002, 03:01 PM
#13
Thread Starter
Lively Member
Hm, I think when i took the 2 forms from my other project and started a new standard EXE to add the forms to i deleted form1 from it, so thats why the error probly...can I email you my whole project? Or, anyone else?
-
Jun 15th, 2002, 03:06 PM
#14
-
Jun 15th, 2002, 03:50 PM
#15
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|