progress bar problem in vb

Reply

Join Date: Oct 2005
Posts: 51
Reputation: jto is an unknown quantity at this point 
Solved Threads: 0
jto jto is offline Offline
Junior Poster in Training

progress bar problem in vb

 
0
  #1
Jan 23rd, 2006
hi,
i am using a progress bar in a conversion program in conversion process progress bar is showing the progress of conversion , but i am using a timer increment for increase the progress bar , but when file is big due to timer is showing the process has been completed but actually file conversion is not completed .Is at any method is there which can calculate the first file size and according to this file size process gets incerement .
Reply With Quote Quick reply to this message  
Join Date: Nov 2005
Posts: 134
Reputation: Yomet is an unknown quantity at this point 
Solved Threads: 10
Yomet Yomet is offline Offline
Junior Poster

Re: progress bar problem in vb

 
0
  #2
Jan 25th, 2006
Hi jto,

If I understand correctly you are loading a file and want the progress bar to indicate how far you have actually come in the load process - correct?

If so you could use the FileLen(<path>) function to get the length of the file initially. You store this in the MaxValue of the progress bar and keep a 'counter' to track how much of the file you have read so far by adding the length of the data you just read to it every time you do an input. Something like this:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Dim BytesRead As Long
  2. Dim InputLine As String
  3.  
  4. ProgressBar.MinValue = 0
  5. ProgressBar.MaxValue = FileLen(<path>)
  6. Open <path> For Input As #1
  7. While Not EOF(1)
  8. LineInput #1, InputLine
  9. BytesRead = BytesRead + Len(InputLine)
  10. ProgressBar.Value = BytesRead
  11. Wend
  12. Close #1
Please note that I have NOT tested this code.

Hope this helps

Happy coding

Yomet
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 51
Reputation: jto is an unknown quantity at this point 
Solved Threads: 0
jto jto is offline Offline
Junior Poster in Training

Re: progress bar problem in vb

 
0
  #3
Jan 31st, 2006
thank u yomet
this working right , but in this progressbar.minvalue is not true command it should be progressbar.min=0 and progressbar.max=0
Reply With Quote Quick reply to this message  
Join Date: Nov 2005
Posts: 134
Reputation: Yomet is an unknown quantity at this point 
Solved Threads: 10
Yomet Yomet is offline Offline
Junior Poster

Re: progress bar problem in vb

 
0
  #4
Feb 2nd, 2006
jto,

I stand (sit) corrected...

Glad you could find the correct syntax for your controls.

Happy coding

Yomet
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC