[Tutorial] Intro to ProgressBars and Timers

Posts 1–13 of 13 · Page 1 of 1
[Tutorial] Intro to ProgressBars and Timers
Simple ProgressBar and Timer Tutorial

Credits all go to me for writing this.


What you need:
1 Button
1 Timer
1 Progress Bar
1 Label


1. Begin by double-clicking the form to view the code. Type in-
Code:
ProgressBar1.Visible = False
2. Double-click the button to view its code and type in your commands. It can be anythin, but include-
Code:
ProgressBar1.Show()
Timer1.Start
Label1.Text = ("Loading...")
3. Then double-click Timer1 to view its code. Type in-
Code:
ProgressBar1.Increment(Insert Value Here)
If ProgressBar1.Value = ProgressBar1.Maximum Then
Timer1.Stop()
Label1.Text = ("Done")
ProgressBar1.Visible = False
If you debug the program, it should show your progress bar loading at the increment you set it at.


If you want a file to be executed at a certain value of the ProgressBar, then you can do something like this-
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Label1.Text = "loading file"
        ProgressBar1.Visible = True
        ProgressBar1.Value = 25
        Process.Start("C:\file.exe" )
        Label1.Text = "loading file2"
        ProgressBar1.Value = 50
        Process.Start("C:\file2.exe" )
        Label1.Text = "loading remaining files..."
        ProgressBar1.Value = 100
        Process.Start("C:\remaining.exe" )
    End Sub
Attached below is my project file. It is a little bit different, but you should get the idea.

I hope this short tutorial is helpful!


Virus Scan: Virustotal. MD5: a995d511ba7a95715d88124fa2c8558a Suspicious.Insightⓘ

VirScan does not allow this to be scanned. sorry.
ProgressBar.rarattachment deleted · 88 downloads before removal
Thanks for sharing , Looks good.
Quote Originally Posted by NextGen1 View Post
Thanks for sharing , Looks good.
thanks for the compliments. i think it is a good tutorial for beginning visual basic coders
Nice and simple. Good tut. I posted something like this a while back
Quote Originally Posted by XGelite View Post
Nice and simple. Good tut. I posted something like this a while back
He's "new" in this section and can't know everything
Again, This falls under the "Simple" or "Basic" One Tut Suggestion
Nice! For deleting or gathering data files you can do something like:

'Load how many files that are going to get deleted.
For each file as string in my.computer.filesystem.getfiles("C:\")
ProgressBar1.Maximum = ProgressBar1.Maximum + 1
Next


'Update the progress bar as you delete...
For each delfile as string in my.computer.filesystem.getfiles("C:\")
Try
My.computer.filesystem.removefile(delfile) 'IDK if that is the correct syntax
ProgressBar1.value = ProgressBar1.value + 1
Catch
End Try
Next


IDK something like that... I had to free hand it so the syntax is probably off by a bit. Hope this helps some people.
Shortening ProgressBar1.value = ProgressBar1.value + 1

ProgressBar1.value += 1
Quote Originally Posted by Blubb1337 View Post
Shortening ProgressBar1.value = ProgressBar1.value + 1

ProgressBar1.value += 1
Yeh that's what i used. The last time i showed someone that i got a "0.o Whats that going to do?"... People... well, they will be people i guess.
It is just a easy syntax. However I do understand you =D Idk why some people don't get such easy terms =/
Quote Originally Posted by Blubb1337 View Post
It is just a easy syntax. However I do understand you =D Idk why some people don't get such easy terms =/
ya seriously. some people try to make expert programs when they cant even grasp the basics
i like it Ive always wonder how timers and progress bars connect
Quote Originally Posted by axel fox View Post
i like it Ive always wonder how timers and progress bars connect
hope u enjoy it
Posts 1–13 of 13 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?