|
-
Mar 18th, 2002, 03:46 AM
#1
Thread Starter
Junior Member
unload form
one of my forms in my project wont reappear after unloaded the last form.
'This wont work
unload game (second)
startup.show (first)
'i need to:
unload startup
and then
load startup again!!!
startup.show
this will return back to windows GUI and then to startup form.
Annoying.
i thought i needed just to unload game, and the startup would reappear. why doesnt it reappear?!
Last edited by Kennethj; Mar 18th, 2002 at 09:04 AM.
-
Mar 18th, 2002, 07:46 AM
#2
1. It should be , not show startup
2. It sounds like Startup is unloaded when Game is loaded. This means that when Game is unloaded, Startup will have to be implicited loaded again, unless you have the Startup.Show in the unload event of the Game form.
-
Mar 18th, 2002, 09:06 AM
#3
Thread Starter
Junior Member
damn
spelling mistake sorry. i have corrected it on my first post. Any who knows why it happens?
My game has two forms.
(The first loaded is Startup.frm then game.frm)
why dont this work:
unload game
startup.show
(project freezes)
need to do this: (annoying) Switching back to Windows GUI!! then back on to startup.
unload game
unload startup
load startup
startup.show
-
Mar 18th, 2002, 09:51 AM
#4
Is there anything in the Game form unload that might conflict with something in the Startup form load?
-
Mar 18th, 2002, 10:45 AM
#5
Thread Starter
Junior Member
dont think so
difficult to say, i would have to show you the whole code, but i havent internet at home where my files reside.
-
Mar 18th, 2002, 12:30 PM
#6
Based on what you presented, I can find nothing wrong. Without seeing exactly what these two forms are doing, it is difficult to recommend a course of action. If you could display the Form_Load and Form_Unload of BOTH forms, that might help.
-
Mar 18th, 2002, 07:04 PM
#7
Member
huh..... I CANT FIND ANYTHING WRONG
THE FORM WONT LOAD OR IT JUST FREEZES..?
wouldn't you
startup.show
unload game
?
I dont get what you want... ohhhh well...
Have a nice day!
[]:::::::::::[];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;/
Did you know that you can be your own grandpa?! It's really cool. . . . . .
------------------------------------------------
But I'm not. . . Im just Myself. . . . .
Not my own grandpa. . . . . .
I put on my own pants today. . . . .
Im so proud of myself. . . . . 
-
Mar 19th, 2002, 09:00 AM
#8
Thread Starter
Junior Member
hmm
i havent used form_unload in any projects, and i didnt seem to need them. they worked properly. but maybe i need to do it in this project.
Give me an example of a code using the form_unload please.
-
Mar 19th, 2002, 09:11 AM
#9
Unload is typically used for housekeeping chores like closing databases, recordsets etc. and clearing out variables, and closing all forms. Here is a typical Unload event for me.
VB Code:
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
Dim i As Long
'close all sub forms
For i = Forms.Count - 1 To 1 Step -1
Unload Forms(i)
Next
'close database and recordset objects
Db.Close
Set rs = Nothing
Rs.Close
End Sub
-
Mar 19th, 2002, 09:21 AM
#10
Thread Starter
Junior Member
sub forms, do you mean all forms loaded after the first one?
in my project startup is loaded at first.
So i use your form_unload code to close all forms, but it will not affect startup.frm. is that correct?
-
Mar 19th, 2002, 09:27 AM
#11
Thread Starter
Junior Member
error
when implementing your unload_form code i receive an error
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
Dim i As Long
'close all sub forms
For i = Forms.Count - 1 To 1 Step -1
Unload Forms(i)
Next
'close database and recordset objects
Db.Close
Set rs = Nothing
Rs.Close
End Sub
The db and rs is not defined.
-
Mar 19th, 2002, 12:15 PM
#12
Db and Rs won't be defined unless you define them. Those two are created by me to refer to my database object and my recordset object. If you have other variables assigned for these functions, or you are not using a database or recordsets, then you don't need to close them when the form is unloaded.
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
|