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
Printable View
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
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
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 ...)
Actually, they're both the same. :rolleyes:
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.
Is show.visible = false the same as frm.hide?
Show.Visible = False? That's a runtime error! :rolleyes:
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)
Thanks Yonatan, how did you know what I really meant?
Wisdom, knowledge, experience, skills.
(P.S. I guessed) :rolleyes:
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
how old are you Yonatan?Quote:
Originally posted by Yonatan
Wisdom, knowledge, experience, skills.
(P.S. I guessed) :rolleyes: