L
lsimoni
When using VB 2005 on windows CE, is it possible to load forms in the
background on application startup? I have several forms that have a bunch of
controls. The first time that the form.show is called, it takes a while to
load the form. But then if the form is hidden / shown again, it goes pretty
quickly. I would like to pre-load all of my forms on startup and then go to
my main screen.
The following is the best I could do. On startup the splash screen is
shown, then each form flickers briefly and then the main form is shown. If
I eliminate the .show/.hide commands, the forms don't flicker, but still take
a while to load when doing the first .show
This is the main form new event:
Public Sub New()
' create and display the splash screen form and make the main form
it's owner
splashScreen = New frmSplashScreen
splashScreen.Owner = Me
splashScreen.Show()
' process the message queue - this is done to allow the splash
screen to be painted
Application.DoEvents()
' disable the main form to avoid the title bar being drawn over the
splash screen during initialization
Me.Enabled = False
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
End Sub
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'load all screens in background so they are all in ram when program
is loaded
fPowerScreen = New frmPower()
fLoadCurveScreen = New frmLoadCurve()
fCqmScreen = New frmCQM()
fToolsScreen = New frmTools()
fAutoSeqScreen = New frmAutoSequence()
fNumPad = New frmNumpadDialog()
fSignature = New frmSignature()
fPowerScreen.Show()
fPowerScreen.Hide()
fLoadCurveScreen.Show()
fLoadCurveScreen.Hide()
fCqmScreen.Show()
fCqmScreen.Hide()
fToolsScreen.Show()
fToolsScreen.Hide()
fAutoSeqScreen.Show()
fAutoSeqScreen.Hide()
fNumPad.Show()
fNumPad.Hide()
Me.Enabled = True
Me.Visible = True
' close the splash screen
splashScreen.Close()
End Sub
background on application startup? I have several forms that have a bunch of
controls. The first time that the form.show is called, it takes a while to
load the form. But then if the form is hidden / shown again, it goes pretty
quickly. I would like to pre-load all of my forms on startup and then go to
my main screen.
The following is the best I could do. On startup the splash screen is
shown, then each form flickers briefly and then the main form is shown. If
I eliminate the .show/.hide commands, the forms don't flicker, but still take
a while to load when doing the first .show
This is the main form new event:
Public Sub New()
' create and display the splash screen form and make the main form
it's owner
splashScreen = New frmSplashScreen
splashScreen.Owner = Me
splashScreen.Show()
' process the message queue - this is done to allow the splash
screen to be painted
Application.DoEvents()
' disable the main form to avoid the title bar being drawn over the
splash screen during initialization
Me.Enabled = False
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
End Sub
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'load all screens in background so they are all in ram when program
is loaded
fPowerScreen = New frmPower()
fLoadCurveScreen = New frmLoadCurve()
fCqmScreen = New frmCQM()
fToolsScreen = New frmTools()
fAutoSeqScreen = New frmAutoSequence()
fNumPad = New frmNumpadDialog()
fSignature = New frmSignature()
fPowerScreen.Show()
fPowerScreen.Hide()
fLoadCurveScreen.Show()
fLoadCurveScreen.Hide()
fCqmScreen.Show()
fCqmScreen.Hide()
fToolsScreen.Show()
fToolsScreen.Hide()
fAutoSeqScreen.Show()
fAutoSeqScreen.Hide()
fNumPad.Show()
fNumPad.Hide()
Me.Enabled = True
Me.Visible = True
' close the splash screen
splashScreen.Close()
End Sub