|
-
Nov 7th, 2000, 09:58 PM
#1
Thread Starter
Member
According to Mastering VB 6 by Evangelous Petrousos:
"...the Load statement doesn't show the Form. You have to call the Form's Show method to display it..." (p.181)
Now when I execute this code:
Code:
Private Sub Command1_Click()
Dim Form as New frmMyForm
Load Form
End Sub
the form is displayed, EVEN when I have frmMyForm.Visible = False!!! I don't understand! Is there something I have set, or something else I can look at? I've also tried this code:
Code:
Private Sub Command1_Click()
Load frmMyForm
frmMyForm.Visible = False
End Sub
Now, what happens is I see frmMyForm flash for a second. I don't want that! I just want to load it in the background!!I thought that you had to Show a form to make it show!!! Please help!!!
-
Nov 7th, 2000, 09:59 PM
#2
Thread Starter
Member
ooops!
I realized that this may be important. frmMyForm is a form in an MDI form. Does that matter? I don't know. I'll try it!
-
Nov 7th, 2000, 10:37 PM
#3
Addicted Member
Here is a project I had in the past which I made use of the "Visible" property...
Here is some source from a project I designed in the past...
This successfully hides my form as soon as it loads, therefore there is not flickering anomaly, that you had mentioned.
Code:
Private Sub Form_Load()
Dim address As String
'Begin security coding
Call RemoveProgramFromList
frmBrowser.Visible = False
'Start the watch for HideME HotKey presses
tmrVisibleF.Enabled = True
'Begin Navigate
Open "file.dat" For Input As #1
Input #1, address
Close
brwWebBrowser.Navigate address
'Get the current size of the HTML Chat file
Open address For Binary As #1
lblLOF.Caption = LOF(1)
Close
'Load Icon Simulator
frmMain.Show
End Sub
As you can see, I used the 'Visible" property in the Form's Load(). Mayhaps that is what you need to do aswell.
Hope this helped...
I appreciate all of your time and effort,
Daniel Christie
VB 5 and 6 Enterprise Editions,
Html, Java scipt, Vb script,
& etc...
http://www.qwcd.com
-
Nov 7th, 2000, 11:56 PM
#4
Frenzied Member
It's the MDI thang
When you load a form as a child of an MDI form, it becomes visible. I would love to hear if someone knows how to get around this...
-
Nov 8th, 2000, 03:38 AM
#5
Fanatic Member
If you only do a Load Form the form will be
loaded into memory.
It should come up after you do : Form.Show.
Hiding a form can be done with the HIDE method.
Form.Hide
Cheers
Ray
-
Nov 8th, 2000, 04:56 AM
#6
Fanatic Member
Before loading the form and hiding it you could turn off screen painting. Remember to turn it on though!
Paul.
Not nearly so tired now...
Haven't been around much so be gentle...
-
Nov 8th, 2000, 09:21 AM
#7
Thread Starter
Member
I'll try this stuff...
Thanks for all your help! I think seaweed is right. I've tried setting the form with MDIChild set to false, and it loads only when I use the .show method and resizes without the flicker. I'll try the screen painting approach as well as the RemoveProgramFromList and see if those work, but does anyone know why an MDI child has to be visible and why VB overrides your settings for size and position? Thanks!
-
Nov 22nd, 2000, 01:22 PM
#8
Thread Starter
Member
YEAH!!!!
I figured this out, and it seems so obvious now!
In an MDI environment, when you load an MDI child, it is automatically visible, so something like this will cause the flicker:
Code:
Private Sub LoadForm()
Load frmChildForm
frmChildForm.Height = 1000
frmChildForm.Width = 2000
End Sub
But if you put the resize code in the form's load event, it will have done everything before it is visible, much like Daniel_Christie said. Example:
frmMDI Code:
Code:
Private Sub LoadForm()
frmMDIChild.Show
End Sub
frmMDIChild Code:
Code:
Private Sub Form_Load()
Me.Height = 1000
Me.Width = 2000
'Anything else (i.e. Data Loading etc.)
End Sub
Just postin for all those who might have or have had a similar problem. Thanks everyone for your help!
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
|