[Help] progress bar

Posts 1–10 of 10 · Page 1 of 1
[Help] progress bar
ok so i have a progress bar that when it hits 10% i want a program to open when it hits 20% and so on but im not sure how to code it i dont think this is right i have

Code:
ProgressBar1.Visible = True
        ProgressBar1.Value = 10
        Process.Start("D:\MW2 Stuff\texture mods\Programs and tools\Adobe_Photoshop_CS5\Adobe Photoshop CS5\Photoshop")
        ProgressBar1.Value = 20
        Process.Start("D:\MW2 Stuff\texture mods\Programs and tools\PakScape\PakScape")
        ProgressBar1.Value = 30
        Process.Start("D:\MW2 Stuff\texture mods\Modding Folder\HxD")

and so on....
Make the Max Value 100

Code:
Private Sub Timer1_Tick(ByVal Sender as system.Object, Byval e as System.Eventargs) Handles Timer1.tick
Select Case ProgressBar1.Value
Case "10"
       Process.Start("Etc")
Case "20"
       Process.Start("Etc")
End Select
End Sub
Off top of head... should work.
ok not sure where to change things around here is my original code im working at the bottom at OpenAll_click
not sure where your code goes in here tried a few times and failed everything opened at form start
right now with the code i have it opens everthing as soon as the button is clicked
Code:
Public Class Form1

    Private Sub pakscape_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pakscape.Click
        System.Diagnostics.Process.Start("D:\MW2 Stuff\texture mods\Programs and tools\PakScape\PakScape")
    End Sub

    Private Sub Photoshop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Photoshop.Click
        System.Diagnostics.Process.Start("D:\MW2 Stuff\texture mods\Programs and tools\Adobe_Photoshop_CS5\Adobe Photoshop CS5\Photoshop")
    End Sub

    Private Sub Hxd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Hxd.Click
        System.Diagnostics.Process.Start("D:\MW2 Stuff\texture mods\Modding Folder\HxD")
    End Sub

    Private Sub CRCFixer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CRCFixer.Click
        System.Diagnostics.Process.Start("D:\MW2 Stuff\texture mods\Programs and tools\CRC32 Fixer\CRCFixer")
    End Sub

    Private Sub ModdingFolder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ModdingFolder.Click
        System.Diagnostics.Process.Start("D:\MW2 Stuff\texture mods\Modding Folder")
    End Sub

    Private Sub NewFolder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewFolder.Click
        System.Diagnostics.Process.Start("D:\MW2 Stuff\texture mods\Modding Folder\New")
    End Sub

    Private Sub OriginalFolder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OriginalFolder.Click
        System.Diagnostics.Process.Start("D:\MW2 Stuff\texture mods\Modding Folder\Original")
    End Sub

    Private Sub IwIxDDS_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles IwIxDDS.Click
        System.Diagnostics.Process.Start("D:\MW2 Stuff\texture mods\Modding Folder\iwi x dds")
    End Sub

    Private Sub DDS2IwI_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DDS2IwI.Click
        System.Diagnostics.Process.Start("D:\MW2 Stuff\texture mods\Modding Folder\dds2iwi")
    End Sub

    Private Sub MainFolder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MainFolder.Click
        System.Diagnostics.Process.Start("C:\Program Files (x86)\Steam\steamapps\common\Alternet\main")
    End Sub

    Private Sub OpenAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenAll.Click
        Label1.Text = ("Loading Files")
        ProgressBar1.Visible = True
        ProgressBar1.Value = 10
        Process.Start("D:\MW2 Stuff\texture mods\Programs and tools\Adobe_Photoshop_CS5\Adobe Photoshop CS5\Photoshop")
        ProgressBar1.Value = 20
        Process.Start("D:\MW2 Stuff\texture mods\Programs and tools\PakScape\PakScape")
        ProgressBar1.Value = 30
        Process.Start("D:\MW2 Stuff\texture mods\Modding Folder\HxD")
        ProgressBar1.Value = 40
        Process.Start("D:\MW2 Stuff\texture mods\Programs and tools\CRC32 Fixer\CRCFixer")
        ProgressBar1.Value = 50
        Process.Start("D:\MW2 Stuff\texture mods\Modding Folder")
        ProgressBar1.Value = 60
        Process.Start("D:\MW2 Stuff\texture mods\Modding Folder\New")
        ProgressBar1.Value = 70
        Process.Start("D:\MW2 Stuff\texture mods\Modding Folder\Original")
        ProgressBar1.Value = 80
        Process.Start("D:\MW2 Stuff\texture mods\Modding Folder\iwi x dds")
        ProgressBar1.Value = 90
        Process.Start("D:\MW2 Stuff\texture mods\Modding Folder\dds2iwi")
        ProgressBar1.Value = 100
        Process.Start("C:\Program Files (x86)\Steam\steamapps\common\Alternet\main")

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ProgressBar1.Visible = False
    End Sub
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        ProgressBar1.Increment(5)
        If ProgressBar1.Value = ProgressBar1.Maximum Then
            Timer1.Stop()
            Label1.Text = ("Done Mod On")
            ProgressBar1.Visible = False
        Else
            Label1.Text = ("Click Start All")
        End If
    End Sub
End Class
Ok add a timer called "timer1"
make it with an increment of 50-100
then instead of this code:
[php]
Private Sub OpenAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenAll.Click
Label1.Text = ("Loading Files")
ProgressBar1.Visible = True
ProgressBar1.Value = 10
Process.Start("D:\MW2 Stuff\texture mods\Programs and tools\Adobe_Photoshop_CS5\Adobe Photoshop CS5\Photoshop")
ProgressBar1.Value = 20
Process.Start("D:\MW2 Stuff\texture mods\Programs and tools\PakScape\PakScape")
ProgressBar1.Value = 30
Process.Start("D:\MW2 Stuff\texture mods\Modding Folder\HxD")
ProgressBar1.Value = 40
Process.Start("D:\MW2 Stuff\texture mods\Programs and tools\CRC32 Fixer\CRCFixer")
ProgressBar1.Value = 50
Process.Start("D:\MW2 Stuff\texture mods\Modding Folder")
ProgressBar1.Value = 60
Process.Start("D:\MW2 Stuff\texture mods\Modding Folder\New")
ProgressBar1.Value = 70
Process.Start("D:\MW2 Stuff\texture mods\Modding Folder\Original")
ProgressBar1.Value = 80
Process.Start("D:\MW2 Stuff\texture mods\Modding Folder\iwi x dds")
ProgressBar1.Value = 90
Process.Start("D:\MW2 Stuff\texture mods\Modding Folder\dds2iwi")
ProgressBar1.Value = 100
Process.Start("C:\Program Files (x86)\Steam\steamapps\common\Alternet\main")

End Sub
[/php]
use this code
[php]
Private Sub OpenAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenAll.Click
Label1.Text = "Loading Files"
ProgressBar1.Visible = True
Timer1.Enabled = True
End Sub
[/php]
and for the timer...
[php]
if ProgressBar1.Value = 10 then
Process.Start("D:\MW2 Stuff\texture mods\Programs and tools\Adobe_Photoshop_CS5\Adobe Photoshop CS5\Photoshop")
end if
if ProgressBar1.Value = 20 then
Process.Start("D:\MW2 Stuff\texture mods\Programs and tools\PakScape\PakScape")
end if
if ProgressBar1.Value = 30 then
Process.Start("D:\MW2 Stuff\texture mods\Modding Folder\HxD")
end if
if ProgressBar1.Value = 40 then
Process.Start("D:\MW2 Stuff\texture mods\Programs and tools\CRC32 Fixer\CRCFixer")
end if
if ProgressBar1.Value = 50 then
Process.Start("D:\MW2 Stuff\texture mods\Modding Folder")
end if
if ProgressBar1.Value = 60 then
Process.Start("D:\MW2 Stuff\texture mods\Modding Folder\New")
if ProgressBar1.Value = 70 then
Process.Start("D:\MW2 Stuff\texture mods\Modding Folder\Original")
end if
if ProgressBar1.Value = 80 then
Process.Start("D:\MW2 Stuff\texture mods\Modding Folder\iwi x dds")
end if
if ProgressBar1.Value = 90 then
Process.Start("D:\MW2 Stuff\texture mods\Modding Folder\dds2iwi")
end if
if ProgressBar1.Value = 100 then
Process.Start("C:\Program Files (x86)\Steam\steamapps\common\Alternet\main")
timer1.enabled = false
Label1.text = "finished" 'or w/e u want it to say...
progressbar1.visible = false
end if
[/php]
*NOTE FOR PEOPLE GOOD AT VB**: Don't flame me cause I kno theres an easier way to do it, Im just making it easier for him to understand the code...
**Lolland, blubb, nextgen (not pointing fingers or anything /)
right now i understand long code better ill learn the short cuts later lol

ok they are still all loading before the progress bar even gets to 10% mass loading

Code:
    Private Sub OpenAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenAll.Click
        Label1.Text = ("Loading Files")
        ProgressBar1.Visible = True
        Timer1.Enabled = True
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ProgressBar1.Visible = False
    End Sub
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        ProgressBar1.Increment(10)
        If ProgressBar1.Value = 10 Then
            Process.Start("D:\MW2 Stuff\texture mods\Programs and tools\Adobe_Photoshop_CS5\Adobe Photoshop CS5\Photoshop")
        End If
        If ProgressBar1.Value = 20 Then
            Process.Start("D:\MW2 Stuff\texture mods\Programs and tools\PakScape\PakScape")
        End If
        If ProgressBar1.Value = 30 Then
            Process.Start("D:\MW2 Stuff\texture mods\Modding Folder\HxD")
        End If
        If ProgressBar1.Value = 40 Then
            Process.Start("D:\MW2 Stuff\texture mods\Programs and tools\CRC32 Fixer\CRCFixer")
        End If
        If ProgressBar1.Value = 50 Then
            Process.Start("D:\MW2 Stuff\texture mods\Modding Folder")
        End If
        If ProgressBar1.Value = 60 Then
            Process.Start("D:\MW2 Stuff\texture mods\Modding Folder\New")
        End If
        If ProgressBar1.Value = 70 Then
            Process.Start("D:\MW2 Stuff\texture mods\Modding Folder\Original")
        End If
        If ProgressBar1.Value = 80 Then
            Process.Start("D:\MW2 Stuff\texture mods\Modding Folder\iwi x dds")
        End If
        If ProgressBar1.Value = 90 Then
            Process.Start("D:\MW2 Stuff\texture mods\Modding Folder\dds2iwi")
        End If
        If ProgressBar1.Value = 100 Then
            Process.Start("C:\Program Files (x86)\Steam\steamapps\common\Alternet\main")
        End If
        If ProgressBar1.Value = ProgressBar1.Maximum Then
            Timer1.Enabled = False
            Label1.Text = "Done Mod On" 'or w/e u want it to say...
            ProgressBar1.Visible = False
        End If
    End Sub
Hmm I'm not 100% sure what you're trying to do, are you trying to make the progress bar increase at a constant rate, and when it reaches a certain value, execute a process?
yes sir every 10th increment i want a diff process to open
Quote Originally Posted by Maniac101 View Post
yes sir every 10th increment i want a diff process to open
Okie dokie, should be easy enough.

Credits here for teaching me something new today (string arrays!)

Alright, first create your array:

Declare this just below Public Class Form1

[php]
Dim ProcList() As String
Dim ListNo As Integer = 10
[/php]

Okay now you have an array, let's create a sub to add items to this array!

[php]
Public Sub AddProc(ByVal Proc2Add As String)
ReDim Preserve ProcList(ListNo)
ProcList(ListNo) = Proc2Add
ListNo += 10 'i made the increment 10 because you wanted it to open each process ever 10 steps on the progressbar.
End Sub
[/php]

Now to add all your crap to the array!

[php]
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

AddProc("D:\MW2 Stuff\texture mods\Programs and tools\Adobe_Photoshop_CS5\Adobe Photoshop CS5\Photoshop")
AddProc("D:\MW2 Stuff\texture mods\Programs and tools\PakScape\PakScape")
AddProc("D:\MW2 Stuff\texture mods\Modding Folder\HxD")
AddProc("D:\MW2 Stuff\texture mods\Programs and tools\CRC32 Fixer\CRCFixer")
AddProc("D:\MW2 Stuff\texture mods\Modding Folder")
AddProc("D:\MW2 Stuff\texture mods\Modding Folder\New")
AddProc("D:\MW2 Stuff\texture mods\Modding Folder\Original")
AddProc("D:\MW2 Stuff\texture mods\Modding Folder\iwi x dds")
AddProc("D:\MW2 Stuff\texture mods\Modding Folder\dds2iwi")
AddProc("C:\Program Files (x86)\Steam\steamapps\common\Alternet\main")

End Sub
[/php]

Now a little sub I whipped up for you:

[php]
Private Sub CheckStart(ByVal WhatNum As Integer)

Dim ss As String = ProcList(WhatNum)

If ss <> "" Then
System.Diagnostics.Process.Start(ss)
End If

End Sub
[/php]

And here's what your timer code should look like:

[php]
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
ProgressBar1.Value += 1
CheckStart(ProgressBar1.Value)
End Sub
[/php]


Done is done
What's your timers interval?
i have been changing it anywhere from 1-100
Posts 1–10 of 10 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us