• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 273
  • Last Modified:

Splash Screen give it more time to display (easy Points)

hi there,
I just add a splash screen form to my project but it quickly disapear. is there a way to show it form longer time? if it is can you show me how?

I'm using the default splah screen that comes with VS 2005
Thanks.
0
jsctechy
Asked:
jsctechy
  • 6
  • 4
  • 4
  • +1
1 Solution
 
hongjunCommented:
You need to add a timer.
0
 
jsctechyAuthor Commented:
well that i know but how?
0
 
hongjunCommented:
1. Set the splash form to be the start up form
2. Add a timer to the splash form and set the Interval to let's say 5000 (5 seconds)
3. Then in the splash form code,


Private Sub Timer1_Timer()
    If Timer1.Interval = 5000 Then
        Timer1.Enabled = False
        Unload Me
        Load frmMain
    End If
End Sub


hongjun
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!

 
jsctechyAuthor Commented:
Unload Me?

Unload is not a declared
Load is an event, and cannot be call directly. Use 'RaiseEvent' statement to raise an event.

so this solution did not work.
0
 
hongjunCommented:
How did you code it?
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
He's using VB.Net 2005 hongjun...

Click on Project --> Properties and set the "Splash screen:" dropdown back to "(None)".

Then, to the right, click on the "View Application Events" button.

Now, across the top of the code editor are two dropdowns.
Change the left dropdown from "(General)", to "(MyApplication Events)".
Next change the right dropdown from "(Declarations)", to "Startup".

Add this line of code to the autogenerated event so it looks like this:

        Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup
            SplashScreen1.ShowDialog()
        End Sub

Finally, in the SplashScreen form, add some Timer code:

Public NotInheritable Class SplashScreen1

    Private WithEvents tmr As New System.Windows.Forms.Timer

    Private Sub SplashScreen1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        tmr.Interval = 5000 ' five seconds
        tmr.Start()

        ' ... other code...

    End Sub

    Private Sub tmr_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles tmr.Tick
        tmr.Stop()
        Me.Close()
    End Sub

End Class
0
 
hongjunCommented:
Oh..
It's appearing in the VB Zone.

Ok.. I saw the tags. Tags <--> Zones.. I am beginning to see these 2 serving similar purposes.

hongjun
0
 
jsctechyAuthor Commented:
Idle_Mind:
I see the two dropdowns on the ApplicationEvents page but there is not "(MyApplication Events)". nor "(Declarations)". how can i get them up there?
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Uh...not sure how you lost them...

Make sure that the "Enable Application Framework" box is CHECKED in the Project Properties page.  Maybe it got unchecked accidentally.  =\

0
 
jsctechyAuthor Commented:
well that it is check and nothing gets display.
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
I can't find a really good picture of the dropdowns...

See:
http://www.coding4fun.net/images/ProgrammingLEGOMindstormsRobotsusingtheM_69D4/MyLego2_thumb.png

You need to pick "(MyApplication Events)" on the left, and "Startup" on the right.

Try closing and then reopening Visual Studio.  =\
0
 
ArkCommented:
using VB.Net 2005
Click on Project --> Properties and set the "Splash screen:" dropdown back to yourSplashScreenFormName.

Then, to the right, click on the "View Application Events" button.
'Add following code
    Partial Friend Class MyApplication
        Protected Overrides Function OnInitialize(ByVal commandLineArgs As System.Collections.ObjectModel.ReadOnlyCollection(Of String)) As Boolean
            Me.MinimumSplashScreenDisplayTime = 5000 '5 seconds
            Return MyBase.OnInitialize(commandLineArgs)
        End Function
    End Class
0
 
jsctechyAuthor Commented:
I have just put this little part on my application aside for now becasue the splahs screen is the least of my worries.
but still does not allow me to change the drop down box
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
It is a standard VB.Net 2005 WinForms app right?  =\

No compact framework or anything unusual about the app?
0
 
jsctechyAuthor Commented:
no in fact i'm just using the for that comes build in on VS 2005 nothing crazy =(
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 6
  • 4
  • 4
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now