How Does Progress Bar Work?
Hey Guys , I just made a very small web browser but i got a problem , i want to attach a Progress Bar to it , so i made one and like tht but it wont <removed by moderator> move :( , And it doesnt have to be attached to The Web Browser , Just help me how to get it moving please?
Re: How Does Progress Bar Work?
to move it you need to increase its value ....ProgressBar1.Value = ProgressBar1.Value + 1
but you need to have proper value to increase the value..for example if you are executing a set of statements to load a page, after each statement you can increment the value and set the max property of the progress bar to 10 for example.
Re: How Does Progress Bar Work?
Please don't swear - it is not only against our rules, but it also annoys people (which means they are less likely to help you).
You can find an explanation of how to use a ProgressBar in the "Controls" section of our Classic VB FAQs (in the FAQ forum, which is shown near the top of our home page)
Re: How Does Progress Bar Work?
Quote:
Originally Posted by ganeshmoorthy
to move it you need to increase its value ....ProgressBar1.Value = ProgressBar1.Value + 1
but you need to have proper value to increase the value..for example if you are executing a set of statements to load a page, after each statement you can increment the value and set the max property of the progress bar to 10 for example.
Yh thnx but now it moves one dot , i want it to move to full slowly , do i have to use a timer or summin? , and if so how does tht work?
Re: How Does Progress Bar Work?
Well yes, if you just do ProgressBar1.Value = ProgressBar1.Value + 1 it will move just one dot, but how you get it to move more depends on what you want it to represent. A simple loop like the following
will move it very quickly but you probably want to have some process of yours to run in that loop.
Code:
Dim lngIndex As Long
For lngIndex = 1 to 100
ProgressBar1.Value = ProgressBar1.Value + lngIndex
Next
Re: How Does Progress Bar Work?
Private Sub Form_Load()
Dim lngIndex As Long
For lngIndex = 1 To 100
ProgressBar1.Value = lngIndex
Next
WebBrowser1.Navigate "http://GamerZ.gnu.nu"
End Sub
Now im using tht and shure it works but how do i get it too move slower?
Re: How Does Progress Bar Work?
A progress bar is used to indicate progress in a process or series of processes where there are benchmarks of some sort that can be counted. Here's an example from a program of mine where I'm gathering information about picture and video files in a folder on my PC. pbThumbnails is the progressbar. Note that I set the Max of the progreebar toi the number of files and everytime I "read" one of the files I advance the progressbar by one.
Code:
intMax = FSO.GetFolder(tvwFolders.SelectedItem.Key).Files.Count
Set FSO = Nothing
pbThumbnails.Max = intMax
Do While Len(strFile)
If UCase$(Right$(strFile, 4)) = ".JPG" Or _
UCase$(Right$(strFile, 4)) = ".MPG" Or _
UCase$(Right$(strFile, 4)) = ".AVI" Then
Set oPicture = New cPicture
oPicture.PicName = tvwFolders.SelectedItem.Key & "\" & strFile
lngIndex = lngIndex + 1 ' didn't actually need this before
gJPEGS.AddPicture oPicture
pbThumbnails.Value = lngIndex
DoEvents
End If
strFile = Dir$
Loop
Re: How Does Progress Bar Work?
Quote:
Originally Posted by MartinLiss
A progress bar is used to indicate progress in a process or series of processes where there are benchmarks of some sort that can be counted. Here's an example from a program of mine where I'm gathering information about picture and video files in a folder on my PC. pbThumbnails is the progressbar. Note that I set the Max of the progreebar toi the number of files and everytime I "read" one of the files I advance the progressbar by one.
Code:
intMax = FSO.GetFolder(tvwFolders.SelectedItem.Key).Files.Count
Set FSO = Nothing
pbThumbnails.Max = intMax
Do While Len(strFile)
If UCase$(Right$(strFile, 4)) = ".JPG" Or _
UCase$(Right$(strFile, 4)) = ".MPG" Or _
UCase$(Right$(strFile, 4)) = ".AVI" Then
Set oPicture = New cPicture
oPicture.PicName = tvwFolders.SelectedItem.Key & "\" & strFile
lngIndex = lngIndex + 1 ' didn't actually need this before
gJPEGS.AddPicture oPicture
pbThumbnails.Value = lngIndex
DoEvents
End If
strFile = Dir$
Loop
Okay well , i dont really get it , but the thing i want is a progress bar to the web explorer im doing , so how do i just slow it down with a timer or summin , and how do i start the timer`?
Re: How Does Progress Bar Work?
Slowing it down wont do any good - for a progressbar to be any use, it needs to be directly related to a particular process (in your case, downloading a page).
If you don't do that, you can easily get to 100% progress before the page has loaded, or only get to 5% before it has loaded. As you had the code it was even worse, as you were guaranteed to get to 100% before you even attempt to load the page.
The article I referred you to explains all of that, and gives alternative methods that you could use instead of a ProgressBar.
I wouldn't be surprised if there is something built in to the WebBrowser to show a ProgressBar (see the Properties window for it), and/or an event which tells you how much progress has been made so far - select "Webbrowser1" in the dropdown list at the top-left of the code window, and see what options are shown in the dropdown list at the top-right.
Re: How Does Progress Bar Work?
Re: How Does Progress Bar Work?
Well i succeded , first i use some timers and in the las timer i use ,
Code:
if WebBrowser1.Busy = 1 Then
......
Else
......
End If
Works really good now