Form problem

fkheng

Centurion
Joined
May 8, 2003
Messages
155
Location
Malaysia
i have a timer on a splash screen, when it's done, it is supposed to open another form...somehow, the form doesn't seem to load...the form's name is fLogin, which i declared somewhere else...

do u think this code is correct?

Private Sub Timer1_Elapsed(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs) Handles Timer1.Elapsed
If ProgressBar1.Value = 100 Then
Timer1.Enabled = False
fLogin.Show()
Me.Close()
Exit Sub
End If
ProgressBar1.Value = ProgressBar1.Value + 10
End Sub
 
VB?

becose in c, c# you put { } after if and without the "then", and by the way do you make the timer.Enable = true?

ahd why don't you put the code into a loop

C#

Timer1.Enabled = true;
ProgressBar1.Value =0;
do
{
ProgressBar1.Value = ProgressBar1.Value + 10;
}
while (ProgressBar1.Value <100);

Timer1.Enabled = False;
fLogin.Show();
Me.Close();
 
Visual Basic:
Private Sub Timer1_Elapsed(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs) Handles Timer1.Elapsed
If ProgressBar1.Value = 100 Then
Timer1.Enabled = False
fLogin.Show()
Me.Hide() 'change this and it should work or you can change your above line to fLogin.ShowDialog()
Exit Sub
End If
ProgressBar1.Value = ProgressBar1.Value + 10
End Sub

Is your splash screen your startup object? If you close the startup object your program will terminate.

Jon
 
Back
Top