Loading

how to unload form and load a new form



hi there...i just want to ask codes on how to unload form if you want to open new form
automatically in visual basic 6...



Command1_click

Form2.show

set Form1 = nothing

end sub

unload me
form2.show

i know that one...
so easy...hehe
my question is that if you open a new form it will unload
what form that is currently open...
....for example if i have 6 forms
i have form1,2,3,4,5,6
if 6 is open then i choose to open 1 the one
will load and 6 will be unload...
then if i open form2 the form6 will be unload..

command1_click

Form1.show

Set Form6 = nothing

end sub

Dim I_am_Open as Boolean

Private Sub Form1_Load()
I_am_Open = true

end sub

Then in the other form

If I_am_Open = true then
CODE
end if

oops !! here it is

command1_click

Form2.show

'....
Form6.hide

Set Form6 = nothing
'....

end sub

you can know if the form is currently open by this step
try to use global variable array
ex.
dim form(5) as boolean
private sub form1_load

form(0)= true

end sub

private sub form1_unload

form(0)=false

end sub

private sub form2_load

form(1)= true

end sub

private sub form2_unload

form(1)=false

end sub
do this to the rest
yan may clue k n ha...
kaw n bahala s iba

open Form2 from Form6

'Remember - Form6_< ACTIVATE >

Form2_Activate

Form6.hide

Set Form6 = Nothing

end sub

hhmm@ofir.dk

F...!! i mean ... Form2_Activate ,,sorry

cedrick blas's picture

me.hide
form2.show 1

hmm if you use ' me.HIDE ' its not Unloading !!

< Form6 >
command1_clik
Form2.show
Form6.hide
Set Form6 = Nothing
End sub

OR Use...

< Form2 >
Form2_Ativate
Form6.hide
Set Form6 = Nothing
End sub

hhmm@ofir.dk

Add new comment