Open file with progressbar get maximum

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • casd
    New Member
    • Mar 2015
    • 2

    Open file with progressbar get maximum

    Good evening
    Im trying to open a file "in my case *.exe " with this code:

    "
    Code:
    Public Class Form1
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Timer1.Start()
        End Sub
    
        Private Sub ProgressBar1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProgressBar1.Click
            
        End Sub
    
        Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
            ProgressBar1.Increment(1)
            If ProgressBar1.Value = ProgressBar1.Maximum Then
                Process.Start("C:\Users\blah\Desktop\myexe.exe")
            End If
            
        End Sub
    End Class
    "

    but its's opening many times..How can i open it only once with progressbar get to maximum? thank you for your time!
    Last edited by Rabbit; Mar 9 '15, 04:19 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Please use code tags when posting code or formatted data.

    You need to stop your timer after you start your process. The timer still ticks and the the bar is still at maximum each time it ticks.

    Comment

    • casd
      New Member
      • Mar 2015
      • 2

      #3
      So after "process.st art" should i use "timer1.end ()" ??

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        Yes , otherwise it will just keep ticking and starting processes.

        Comment

        Working...