By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,805 Members | 1,270 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,805 IT Pros & Developers. It's quick & easy.

Open file with progressbar get maximum

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

"
Expand|Select|Wrap|Line Numbers
  1. Public Class Form1
  2.  
  3.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  4.         Timer1.Start()
  5.     End Sub
  6.  
  7.     Private Sub ProgressBar1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProgressBar1.Click
  8.  
  9.     End Sub
  10.  
  11.     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  12.         ProgressBar1.Increment(1)
  13.         If ProgressBar1.Value = ProgressBar1.Maximum Then
  14.             Process.Start("C:\Users\blah\Desktop\myexe.exe")
  15.         End If
  16.  
  17.     End Sub
  18. 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!
Mar 9 '15 #1
Share this Question
Share on Google+
3 Replies


Rabbit
Expert Mod 10K+
P: 12,364
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.
Mar 9 '15 #2

P: 2
So after "process.start" should i use "timer1.end()" ??
Mar 10 '15 #3

Rabbit
Expert Mod 10K+
P: 12,364
Yes , otherwise it will just keep ticking and starting processes.
Mar 10 '15 #4

Post your reply

Sign in to post your reply or Sign up for a free account.