|
-
Sep 13th, 2000, 09:39 AM
#1
Thread Starter
Member
When I want my program to show a new form I can either use:
Form1.Visible = True
or
Form1.Show
Both work interchangably in my program and seem to have the same effects on the data I was just wondering if one was better.
Thanks
Jim
"...head is all empty and I don't care..."
-
Sep 13th, 2000, 10:02 AM
#2
Addicted Member
Hi,
Form.Show is better than Form.visible=True:
When you unload a form it is cleared from memory thus freeing up resources, you then use form.show to load it back up again. However if you just use form.visible=true/false, then the form is always in the memory whether it is visible or not.
hope this helps
Shaun
Web/Application Developer
VB6 Ent (SP5), Win 2000,SQL Server 2000
-
Sep 13th, 2000, 10:31 AM
#3
Frenzied Member
Actually none is better because they have 2 different functions, Show Loads AND displays them, Visible = True only displays it.
S@nsins is right about loading and stuff, but if you need to make a form invisible for a very short time (making a snapshot of the things below your prog) it would be better to use Form2.Visible = False, make the snapshot, Form2.Visible = True
This would result in a faster way then Unload Form2, make snapshot, Form2.Show
Know what I mean?
But anyway, to load a form the first time you need to show it with Form.Show, and don't forget to Unload it, don't use End because it's a brute way to quit a program! (not saving, no Unloading from memory, no closing files and ...)
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Sep 13th, 2000, 10:36 AM
#4
Guru
Actually, they're both the same. 
If Form1 isn't loaded, and you want its Show function, VB loads it and then runs the Show function.
All this function does (with default parameters) is change the Visible to True.
Of course the form is loaded, otherwise the function would be inaccessible.
Also, Form1.Visible = True loads the form if it's not loaded, because otherwise the Visible property is inaccessible.
-
Sep 14th, 2000, 08:06 AM
#5
Is show.visible = false the same as frm.hide?
-
Sep 14th, 2000, 08:45 AM
#6
Guru
Show.Visible = False? That's a runtime error! 
Code:
MyForm.Visible = False
' Is equivalent to:
Call MyForm.Hide
' If MyForm isn't loaded, the above two examples are also equivalent to:
Call Load(MyForm)
-
Sep 14th, 2000, 10:18 AM
#7
Thanks Yonatan, how did you know what I really meant?
-
Sep 14th, 2000, 10:53 AM
#8
Guru
Wisdom, knowledge, experience, skills.
(P.S. I guessed)
-
Sep 14th, 2000, 12:20 PM
#9
Lively Member
Actually, from what I believe, a form is still in memory until you set it's instance to nothing. Even if you are just using the name of the form instead of a new instance you should set it to nothing:
Eg:
Code:
frmMain.Show
Unload frmMain
Set frmMain = Nothing
-
Sep 15th, 2000, 06:20 AM
#10
Conquistador
Originally posted by Yonatan
Wisdom, knowledge, experience, skills.
(P.S. I guessed)
how old are you Yonatan?
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
|