Support Forums

Full Version: Simple loading bar
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Code:
Dim i As Integer

Private Sub Form_Load()
     i = 0
     Timer1.Enabled = True
     Timer1.Interval = 20
End Sub

Private Sub Timer1_Timer()
     ProgressBar1.Value = i / 50 * 100
     i = i + 1
     If i > 50 Then
        Timer1.Enabled = False
    Unload Me
Form1.Show
     End If
End Sub

Taken from:

http://www.vbforums.com/showthread.php?t=421073

All credits go to their creators.


Does anyone else have a better code?

I would like to use it.
(11-18-2010, 11:09 AM)Extremespeed™ Wrote: [ -> ]
Code:
Dim i As Integer

Private Sub Form_Load()
     i = 0
     Timer1.Enabled = True
     Timer1.Interval = 20
End Sub

Private Sub Timer1_Timer()
     ProgressBar1.Value = i / 50 * 100
     i = i + 1
     If i > 50 Then
        Timer1.Enabled = False
    Unload Me
Form1.Show
     End If
End Sub

Taken from:

http://www.vbforums.com/showthread.php?t=421073

All credits go to their creators.


Does anyone else have a better code?

I would like to use it.

All you need is a timer. And in the Timer you go progressbar1.increment(1)

And the increment(?) is by how much it goes up and how fast it goes..

Then all you have to do is enable the timer when you want the progress bar to go.
(11-18-2010, 02:38 PM)Xzotic Wrote: [ -> ]All you need is a timer. And in the Timer you go progressbar1.increment(1)

And the increment(?) is by how much it goes up and how fast it goes..

Then all you have to do is enable the timer when you want the progress bar to go.


What he means is, all your code is doing is...

ProgressBar1.Increment(2)

it looks like you took that code out of a splash screen.

do like Xzotic said...

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

then set the interval from the properties window.
so that you don't get errors, add this bit in.

Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If Not ProgressBar1.Value = ProgressBar1.Maximum Then
            ProgressBar1.Increment(2)
        Else
            Timer1.Enabled = False
        End If
End Sub
Nice tut even though it was from Hackforums.net / But this will help out others that doesn't understand anything from youtube.
(11-19-2010, 12:35 AM)JesusFromHF Wrote: [ -> ]Nice tut even though it was from Hackforums.net / But this will help out others that doesn't understand anything from youtube.

I dont mean to be rude, but what are you trying to say?

He credited his source:
(11-18-2010, 11:09 AM)Extremespeed™ Wrote: [ -> ]Taken from:

http://www.vbforums.com/showthread.php?t=421073

All credits go to their creators.
Pretty simple, but still nice for people to learn from.
Nice tutorial, and great share. I've also seen this on HF.
very good sources /tutorial , thanks for sharing...
Needs some improvements, but otherwise it's looking good.
Thank you very much for this share, I appreciate it.

Now I understand this.