?
Solved

Splash window

Posted on 2003-03-30
7
Medium Priority
?
146 Views
Last Modified: 2010-05-01
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
Comment
Question by:maan1970
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 14

Accepted Solution

by:
aelatik earned 80 total points
ID: 8234274
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
 
LVL 14

Expert Comment

by:aelatik
ID: 8234275
There is a typo in my code, replace unlaod woth unload
0
 
LVL 3

Expert Comment

by:Barca
ID: 8234504
Private Sub Form_Load()
Timer1.Interval = 5000
Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
  Form1.Show
  Unlaod Me
End Sub
0
Technology Partners: 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!

 
LVL 2

Expert Comment

by:Jzaltheral
ID: 8234634
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
 
LVL 2

Expert Comment

by:Jzaltheral
ID: 8234653
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
 

Expert Comment

by:Augury
ID: 8236215
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
 
LVL 3

Expert Comment

by:sanjaykattimani
ID: 8244235
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month10 days, 21 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question