By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,369 Members | 1,131 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,369 IT Pros & Developers. It's quick & easy.

Load a form without blinking...

P: n/a
I am trying to load a form (load Me) without the form becoming visible. If
I try me.hide or me.visible = false, they load the form and the form blinks
before becoming invisible. Is there a way to load the form without it
becoming visible at all until I say me.visible = true?

Thanks.

Matthew Wells
MW****@NumberCruncher.com
Jul 17 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Load Me?

I'd imagine this line of code is in the form's module, right?
This code is only get to run when the form HAS BEEN loaded. So, why load
itself again?

To load form but to showing it, you do

Dim myForm As TheForm

'Load an instance of TheForm into memory
'You can access the frm without showing it
Set myForm=New TheForm
myForm.Caption="XXXXXXXXXXXXXXX"
'Do other things
'Show form
myForm.Show 'You will see the form's caption is changed to
"XXXXXXXXXXXXXXXXXX"

"Matthew Wells" <MW****@NumberCruncher.com> wrote in message
news:OE*******************@bignews6.bellsouth.net. ..
I am trying to load a form (load Me) without the form becoming visible. If I try me.hide or me.visible = false, they load the form and the form blinks before becoming invisible. Is there a way to load the form without it
becoming visible at all until I say me.visible = true?

Thanks.

Matthew Wells
MW****@NumberCruncher.com

Jul 17 '05 #2

P: n/a
Load Form1 will, perhaps not surprisingly, load form1. As the Load part
indicates, it loads, not shows. Do you have a Refresh statement or an
implicit Show statement somewhere in your code?

You do *not* have to use the Dim f as TheForm as suggested in another
response. Doing so in a non-MDI application is guaranteed to get you into
trouble down the road.

--

Randy Birch
MVP Visual Basic
http://vbnet.mvps.org/
Please respond only to the newsgroups so all can benefit.
"Matthew Wells" <MW****@NumberCruncher.com> wrote in message
news:OE*******************@bignews6.bellsouth.net. ..
: I am trying to load a form (load Me) without the form becoming visible.
If
: I try me.hide or me.visible = false, they load the form and the form
blinks
: before becoming invisible. Is there a way to load the form without it
: becoming visible at all until I say me.visible = true?
:
: Thanks.
:
: Matthew Wells
: MW****@NumberCruncher.com
:
:
Jul 17 '05 #3

P: n/a

"Matthew Wells" <MW****@NumberCruncher.com> wrote in message
news:OE*******************@bignews6.bellsouth.net. ..
I am trying to load a form (load Me) without the form becoming visible. If I try me.hide or me.visible = false, they load the form and the form blinks before becoming invisible. Is there a way to load the form without it
becoming visible at all until I say me.visible = true?


You obviously can't load the form from itself. In order to do that the form
must have already been active (since your code is obviously executing) so
that's probably the blink you saw.

Instead of starting your code with a form, start your code in a module
"Main" from there you can issue the Load form command.

Do other things after the load command and when you're ready, just do
form.show

Just make sure that in the form load command, you don't have anything that
triggers a refresh because the code in this section is executed when the
form is loaded.


Jul 17 '05 #4

P: n/a
"Raoul Watson" <Wa*****@IntelligenCIA.com> wrote in message news:<KP************@nwrdny03.gnilink.net>...
"Matthew Wells" <MW****@NumberCruncher.com> wrote in message
news:OE*******************@bignews6.bellsouth.net. ..
I am trying to load a form (load Me) without the form becoming visible. If
I try me.hide or me.visible = false, they load the form and the form

blinks
before becoming invisible. Is there a way to load the form without it
becoming visible at all until I say me.visible = true?


You obviously can't load the form from itself. In order to do that the form
must have already been active (since your code is obviously executing) so
that's probably the blink you saw.


You can load the form from itself; start a new project and add a BAS
module and set the startup object to Sub Main and try this code:

' in the BAS module
Private Sub Main()
Dim f As Form1
Set f = New Form1
f.doit
Unload f
End Sub

' in the form
Public Sub doit()
Debug.Print "Doit start"
Load Me
Debug.Print "Doit Done"
End Sub

Private Sub Form_Initialize()
Debug.Print "Init"
End Sub

Private Sub Form_Load()
Debug.Print "Load"
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Debug.Print "QueryUnload"
End Sub

Private Sub Form_Terminate()
Debug.Print "Term"
End Sub

Private Sub Form_Unload(Cancel As Integer)
Debug.Print "Unload"
End Sub
Instead of starting your code with a form, start your code in a module
"Main" from there you can issue the Load form command.

Do other things after the load command and when you're ready, just do
form.show

Just make sure that in the form load command, you don't have anything that
triggers a refresh because the code in this section is executed when the
form is loaded.


that is probably the problem... something in Form_Load is causing the
form to be displayed.
Jul 17 '05 #5

P: n/a
Here's the exact problem. I want to position the controls BEFORE the form
becomes visible. The form is resizable so I have code in the Form_Resize
event. Loading the form by itself does not cause the blink, but after the
code in Fomr_Load finished, it steps into Form_Resize and that's what causes
the blink. I even have the form et to Visible=False in design view. I put
the code in Form_Resize in a sub and tried calling the sub while the form
was hidden - but when I do me.visible = true, the controls aren't moved.
It's very ugly to have it visible. BTW, it's an MID child form.

Any more ideas?
"Matthew Wells" <MW****@NumberCruncher.com> wrote in message
news:OE*******************@bignews6.bellsouth.net. ..
I am trying to load a form (load Me) without the form becoming visible. If I try me.hide or me.visible = false, they load the form and the form blinks before becoming invisible. Is there a way to load the form without it
becoming visible at all until I say me.visible = true?

Thanks.

Matthew Wells
MW****@NumberCruncher.com

Jul 17 '05 #6

P: n/a
"Matthew Wells" <MW****@NumberCruncher.com> wrote in message news:<O7**************@bignews5.bellsouth.net>...
<cu>
BTW, it's an MID child form.


Check the 'AutoShowChildren' property of the MDI parent
Jul 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.