|
-
Aug 20th, 2008, 03:12 PM
#1
Thread Starter
Junior Member
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?
Last edited by si_the_geek; Aug 20th, 2008 at 03:50 PM.
-
Aug 20th, 2008, 03:50 PM
#2
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.
If an answer to your question has been helpful, then please, Rate it!
Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.
-
Aug 20th, 2008, 03:52 PM
#3
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)
-
Aug 20th, 2008, 03:56 PM
#4
Thread Starter
Junior Member
Re: How Does Progress Bar Work?
 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?
-
Aug 20th, 2008, 05:38 PM
#5
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
-
Aug 21st, 2008, 06:54 AM
#6
Thread Starter
Junior Member
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?
-
Aug 21st, 2008, 09:38 AM
#7
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
-
Aug 21st, 2008, 09:43 AM
#8
Thread Starter
Junior Member
Re: How Does Progress Bar Work?
 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`?
-
Aug 21st, 2008, 02:58 PM
#9
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.
-
Aug 21st, 2008, 03:30 PM
#10
Fanatic Member
Re: How Does Progress Bar Work?
-
Aug 22nd, 2008, 11:33 AM
#11
Thread Starter
Junior Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|