load another form and i want a progress bar to work with it.

Recommended Answers

All 24 Replies

You can use Timer control for this...

Yes but I dont know how to make it load the form after the loadbar is completed here is my code so far

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        ProgressBar1.Increment(+1000)
    End Sub

    Private Sub Title_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If Timer1.Enabled = True Then Login.Show()
    End Sub
End Class

Use this

'First declare i as integer=0

 Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        i += 1
        If i > 10 Then 'Here i use 10 seconds to load the new form
            Nextform.Show()
            Timer1.Stop()
        End If
    End Sub

Set timer interval as 1000 from the property window.

Set timer interval as 1000 from the property window.

'i' is not declared. (sorry im new)

Public Class ABC
'After class name declare i
    Dim i As Integer = 0

How do i make the title page close after?

If i > 10 Then
            Nextform.Show()
            Timer1.Stop()
            Me.Close '// Close current Form.
        End If
If i > 10 Then
            Nextform.Show()
            Timer1.Stop()
            Me.Close '// Close current Form.
        End If

Doesnt work it closes all forms

Post your "imitating" Form's code.

'Makes the Progress bar work.
        ProgressBar1.Increment(+200)

        'Loads the Login Form.
        Dim i As Integer = 2000
        If i > 2000 Then


        End If
        Login.Show()
        Me.Close()

Maybe the magic can be to create a new module with a Sub Main and use this sub for starting the project in the project properties page.

This sub can do the following:

* Instantiate a new titleForm.
* Show the titleform.
* Do the progress bar movement for the titleForm
* instantiate the logonForm
* Close the titleForm
* Show in dialog mode the logonForm.

Hope this helps

commented: just because you seem to deserve more rep. points for all the help provided on this forum. :) +10

I need help.

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

        Sub Main()

      
        'Makes the Progress bar work.
        ProgressBar1.Increment(+1000)

        'Loads the Login Form.
        Dim i As Integer = 1000
        i += 1
        If i > 1 Then
            Login.Show()
            Timer1.Stop()
        End If
        Login.Show()
        Me.Close()

    End Sub
End Class

sub main is not working

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        With ProgressBar1
            .Maximum = 100
        End With
        With Timer1
            .Interval = 500 '// 1/2 sec. delay.
            Me.Show() '// display Form before starting Timer.
            .Start() '// start Timer.
        End With
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Static iCount As Integer = 0
        If Not iCount = 10 Then
            iCount += 1
            ProgressBar1.Value += 10
        Else
            frmLogin.Show()
            Me.Close() '// stops the Timer as well.
        End If
    End Sub
End Class

Try my previous code in a new project.
Leave Form1's .Name as is and add a new form named "frmLogin".
Don't forget about the app.s properties of "When last form closes".

Let me know how that goes, and if still Nothing, I am still done with this thread. Good luck.

Ah I forgot the When last form closes option! Thanks. Plus the code you gave me is better then the first!

I'm still done with this thread.:D
Glad I could help.:)

Actually if you close parent form. Then all form will close.

So simply hide the form.

If i > 10 Then
            Nextform.Show()
            Timer1.Stop()
            Me.Hide '// Hide current Form.
        End If

Hey don't close that form simply hide it. Becoz when parent form get closed all child form will also close.

So try this..

If i > 10 Then
            Nextform.Show()
            Timer1.Stop()
            Me.Hide'// Hide current Form.
        End If

post your code for further help. let us see what you have.

This thread is solved, stop replying until further questions by o.p.. Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.