Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 148
  • Last Modified:

Splash window

Dear All,

I have written a script to display one window the hide it and display another.
    Form2.Show
    Load Form1
    Form2.Hide
    Form1.Show
Here Form2 is almost invisible. Is it possible to display Form2 for around 5 secs then only show Form1 ?

Thnx & rgds

0
maan1970
Asked:
maan1970
1 Solution
 
aelatikCommented:
You have to do it with a timer control, place a timer on your splash form and use code below...

Private Sub Form_Load()
Dim Counter As Long
Counter = 0
Timer1.Interval = 1000
Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
Counter = Counter + 1
If Counter = 5 Then
   Form1.Show
   Unlaod Me
End If
End Sub

Happy Programming,
0
 
aelatikCommented:
There is a typo in my code, replace unlaod woth unload
0
 
BarcaCommented:
Private Sub Form_Load()
Timer1.Interval = 5000
Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
  Form1.Show
  Unlaod Me
End Sub
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
JzaltheralCommented:
The only thing I would add to the comments above is that I hate sitting through spalsh screens, so I always design mine to go away when the user clicks on the form itself or hits a key.  Here's the code behind a pretty standard splash screen for an app I am currently developing.


Option Explicit

Private Sub Form_KeyPress(KeyAscii As Integer)
    Call frmMain.Show
    Call Unload(frmSplash)
End Sub

Private Sub Frame1_Click()
    Call frmMain.Show
    Call Unload(frmSplash)
End Sub

Private Sub Timer1_Timer()
    Call frmMain.Show
    Call Unload(frmSplash)
End Sub

Jzal
0
 
JzaltheralCommented:
As a side note - the Sub Frame1_Click is there because I have a frame on my splash screen that covers the form - so the user can't actually click on the form itself, from VB's point of view.  That could just as easily be Private Sub Form_Click() if you wanted it to be.

Jzal
0
 
AuguryCommented:
For your purpose I propose that you should use a frame rather then a form. I suggest this because forms are a lot more memory intensive and on slower computers tend to hang when unloading them.

Sample Coding: Where Form1 is your original Form1 and SplashFrame is your original Form2.

Private Sub Form_Load()
Form1.Height = SplashFrame.Height
Form1.Width = SplashFrame.Width
SplashFrame.Top = 0
SplashFrame.Left = 0
SplashTimer.Enabled = True
End Sub

Private Sub SplashTimer_Timer()
SplashFrame.Visible = False
Form1.Height = 3600
Form1.Width = 4800
SplashTimer.Enabled = False
End Sub

Augury

0
 
sanjaykattimaniCommented:
Assuming form2 is your splash screen.

   Form2.Show
   doevents
   Load Form1

''Write first statement in form.FormLoad event as
'form2.show
'Doevents
''that will make sure splash is always on

   doevents
   Form2.Hide
   Doevents
   Form1.Show

'Doevents will make sure gui is refreshed.

Hope that helps
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now