load form

  • Thread starter Thread starter yxq
  • Start date Start date
Y

yxq

Hi,
My form will execute lots of codes when loaded, result in the form shown
slowly, how to execute the codes after the form already shown?

Thanks
 
Hi Yxq

I think that has no benefit,

Maybe this splash form is something for you?

Cor
\\\form1
Private frm As New Form2
Private Sub Form1_Load(ByVal sender _
As Object, ByVal e As System.EventArgs) _
Handles MyBase.Load
frm.Show()
End Sub

///
\\\form2

Private WithEvents timer1 As New Windows.Forms.Timer
Private Sub Form2_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Text = "I am busy"
Me.ForeColor = Color.White
timer1.Enabled = True
timer1.Interval = 125
Me.BackColor = Color.CornflowerBlue
Me.Opacity = 1
Me.TopMost = True
Me.Text = "Splash"
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles timer1.Tick
Me.Opacity -= 0.01
If Me.Opacity = 0 Then
timer1.Enabled = False
Me.Close()
End If
End Sub
///
 
I don't know what your code is doing. But I think if you could sperate your code to a function from your form, then you can put your the function in Main just after the form show. Something like this

Public Shared Sub Main(
Dim myForm As New Form
myForm.Show(

myForm.myFunction(

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top