splash from w/ progress bar

Posted on 2006-05-11
Last Modified: 2008-03-06
I want my applications to start in a sub main, to invoke the frmMain load event, and while this event is running to pop up a splash screen with a progress bar.  The screens are already designed, but I can't seem to get the splash screen to do anything.  As a test, I've done this, using the "sleep" to emulate having the load event do a lot of stuff:

Module modMain
    Sub main()
        Dim fMain As New frmMain

            If Diagnostics.Process.GetProcessesByName(Diagnostics.Process.GetCurrentProcess.ProcessName).Length > 1 Then
                MsgBox("Application is already running on this machine!", _
                    MsgBoxStyle.Exclamation + MsgBoxStyle.OKOnly, "Shutting Down")
            End If

        Catch ex As Exception
            MsgBox(Err.Description & " Startup")
        End Try
    End Sub
End Module

''''''''''''''''''''in frmMain
    Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim fSplash As New frmSplash


   end sub

'''''''''''''''''in frmSplash
    Private Sub timSplash_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles timSplash.Tick
            If pbSplash.Value < 100 Then
                pbSplash.Value += 10
                pbSplash.Value = 10
            End If

        Catch ex As Exception

        End Try
    End Sub

    Private Sub frmSplash_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    End Sub

The result is that frmSplash pops up, but not completely "painted" (e.g., the label caption doesn't show), and the progress bar does nothing.

what am I doing wrong?


Question by:g_johnson
    LVL 85

    Accepted Solution

    "what am I doing wrong?"

    This line:


    Completely suspends your application for sixty seconds...thus preventing it from painting itself properly or responding to your Timer events.

    LVL 4

    Author Comment

    thanks -- so it turns out to be a bad test.

    I put in a better test

    for l = 1 to 10000000000
    next 'l

    And all works fine ...

    thanks again.

    LVL 85

    Expert Comment

    by:Mike Tomlinson
    Also, instead of:


    It should be:


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Suggested Solutions

    This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
    Introduction When many people think of the WebBrowser ( control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now