Instead of form_load...

lidds

Junior Contributor
Joined
Nov 9, 2004
Messages
210
Is there some place on a form e.g. sub etc. that I can code before the form_load sub is called.

What I have is a sub that loads embedded icons onto my form, at the moment this sub is called from the form_load sub, but it shows the form and then the user is able to see the icons appear. So what I want is a place that I can load the icons prior to the from being displayed.

I hope that mades sense???

Thanks

Simon
 
You could create a sub main and load that first. I.E.

Code:
    Sub Main()

        ' I normally display a splash screen 
        ' so that the users knows the program is working

        Dim splash As New frmSplashScreen

        splash.prgProgressBar.Maximum = 3031
        splash.prgProgressBar.Minimum = 0
        splash.prgProgressBar.Value = 1

        splash.Show()
        splash.Refresh()

        Dim t1 As DateTime = Now
        Dim t2 As DateTime = Now

        Do Until t2 > t1.AddSeconds(4)
            ' Increases the value displayed by the progress bar.
            If splash.prgProgressBar.Value <> 3031 Then
                splash.prgProgressBar.Value += 1
                splash.Refresh()
            End If
            t2 = Now
        Loop

        splash.Close()

        '  Once Items loaded Display your main form
        Application.Run(New your Program name frmTest)

    End Sub

Hope this makes sense and helps.
 
I have added the code that I want to be run before the form is shown, the only problem I have found is that as some of my code is to populate a listview with data, this data does not seem to be displayed in the listview.

Is there a way to get around this or am I doing something wrong???

Thanks for the help

Simon
 
Back
Top