We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,371 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

I want to make a Form that imitates a load and waits a few seconds to...

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

5
Contributors
24
Replies
5 Hours
Discussion Span
1 Year Ago
Last Updated
26
Views
Question
Answered
DisasterPiece
Light Poster
26 posts since Aug 2011
Reputation Points: 8
Solved Threads: 0
Skill Endorsements: 0

You can use Timer control for this...

kingsonprisonic
Posting Whiz in Training
268 posts since Nov 2009
Reputation Points: 61
Solved Threads: 54
Skill Endorsements: 0

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
DisasterPiece
Light Poster
26 posts since Aug 2011
Reputation Points: 8
Solved Threads: 0
Skill Endorsements: 0

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
kingsonprisonic
Posting Whiz in Training
268 posts since Nov 2009
Reputation Points: 61
Solved Threads: 54
Skill Endorsements: 0

Set timer interval as 1000 from the property window.

kingsonprisonic
Posting Whiz in Training
268 posts since Nov 2009
Reputation Points: 61
Solved Threads: 54
Skill Endorsements: 0

Set timer interval as 1000 from the property window.

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

DisasterPiece
Light Poster
26 posts since Aug 2011
Reputation Points: 8
Solved Threads: 0
Skill Endorsements: 0
Public Class ABC
'After class name declare i
    Dim i As Integer = 0
kingsonprisonic
Posting Whiz in Training
268 posts since Nov 2009
Reputation Points: 61
Solved Threads: 54
Skill Endorsements: 0

How do i make the title page close after?

DisasterPiece
Light Poster
26 posts since Aug 2011
Reputation Points: 8
Solved Threads: 0
Skill Endorsements: 0
If i > 10 Then
            Nextform.Show()
            Timer1.Stop()
            Me.Close '// Close current Form.
        End If
codeorder
Postaholic
2,124 posts since Aug 2010
Reputation Points: 256
Solved Threads: 387
Skill Endorsements: 8
If i > 10 Then
            Nextform.Show()
            Timer1.Stop()
            Me.Close '// Close current Form.
        End If

Doesnt work it closes all forms

DisasterPiece
Light Poster
26 posts since Aug 2011
Reputation Points: 8
Solved Threads: 0
Skill Endorsements: 0
codeorder
Postaholic
2,124 posts since Aug 2010
Reputation Points: 256
Solved Threads: 387
Skill Endorsements: 8
DisasterPiece
Light Poster
26 posts since Aug 2011
Reputation Points: 8
Solved Threads: 0
Skill Endorsements: 0

Post your "imitating" Form's code.

codeorder
Postaholic
2,124 posts since Aug 2010
Reputation Points: 256
Solved Threads: 387
Skill Endorsements: 8
'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()
DisasterPiece
Light Poster
26 posts since Aug 2011
Reputation Points: 8
Solved Threads: 0
Skill Endorsements: 0

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

lolafuertes
Practically a Posting Shark
890 posts since Oct 2008
Reputation Points: 164
Solved Threads: 189
Skill Endorsements: 5

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

DisasterPiece
Light Poster
26 posts since Aug 2011
Reputation Points: 8
Solved Threads: 0
Skill Endorsements: 0
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
codeorder
Postaholic
2,124 posts since Aug 2010
Reputation Points: 256
Solved Threads: 387
Skill Endorsements: 8

Nothing.

DisasterPiece
Light Poster
26 posts since Aug 2011
Reputation Points: 8
Solved Threads: 0
Skill Endorsements: 0

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.

codeorder
Postaholic
2,124 posts since Aug 2010
Reputation Points: 256
Solved Threads: 387
Skill Endorsements: 8

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

DisasterPiece
Light Poster
26 posts since Aug 2011
Reputation Points: 8
Solved Threads: 0
Skill Endorsements: 0

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.1174 seconds using 2.7MB