473,385 Members | 1,855 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Need Help with Progress Bar

yoda
291 100+
Code for that i made up doesn't work whats wrong?

Private Sub Command1_Click()
If Command1 Is pressed Then start ProgressBar1
End Sub

that's to start the progress bar but it doesn't.

Also do you know how to auto load a web page with MDI form or the frmBrowser form. Here the code for the frmbrowser form.

Option Explicit

Public StartingAddress As String
Dim mbDontNavigateNow As Boolean
Private Sub Form_Load()
On Error Resume Next
Me.Show
tbToolBar.Refresh
Form_Resize

cboAddress.Move 50, lblAddress.Top + lblAddress.Height + 15

If Len(StartingAddress) > 0 Then
cboAddress.Text = StartingAddress
cboAddress.AddItem cboAddress.Text
'try to navigate to the starting address
timTimer.Enabled = True
brwWebBrowser.Navigate StartingAddress
End If

End Sub



Private Sub brwWebBrowser_DownloadComplete()
On Error Resume Next
Me.Caption = brwWebBrowser.LocationName
End Sub

Private Sub brwWebBrowser_NavigateComplete(ByVal URL As String)
Dim i As Integer
Dim bFound As Boolean
Me.Caption = brwWebBrowser.LocationName
For i = 0 To cboAddress.ListCount - 1
If cboAddress.List(i) = brwWebBrowser.LocationURL Then
bFound = True
Exit For
End If
Next i
mbDontNavigateNow = True
If bFound Then
cboAddress.RemoveItem i
End If
cboAddress.AddItem brwWebBrowser.LocationURL, 0
cboAddress.ListIndex = 0
mbDontNavigateNow = False
End Sub

Private Sub cboAddress_Click()
If mbDontNavigateNow Then Exit Sub
timTimer.Enabled = True
brwWebBrowser.Navigate cboAddress.Text
End Sub

Private Sub cboAddress_KeyPress(KeyAscii As Integer)
On Error Resume Next
If KeyAscii = vbKeyReturn Then
cboAddress_Click
End If
End Sub

Private Sub Form_Resize()
cboAddress.Width = Me.ScaleWidth - 100
brwWebBrowser.Width = Me.ScaleWidth - 100
brwWebBrowser.Height = Me.ScaleHeight - (picAddress.Top + picAddress.Height) - 100
End Sub

Private Sub picAddress_Click()

End Sub

Private Sub timTimer_Timer()
If brwWebBrowser.Busy = False Then
timTimer.Enabled = False
Me.Caption = brwWebBrowser.LocationName
Else
Me.Caption = "Working..."
End If
End Sub

Private Sub tbToolBar_ButtonClick(ByVal Button As Button)
On Error Resume Next

timTimer.Enabled = True

Select Case Button.Key
Case "Back"
brwWebBrowser.GoBack
Case "Forward"
brwWebBrowser.GoForward
Case "Refresh"
brwWebBrowser.Refresh
Case "Home"
brwWebBrowser.GoHome
Case "Search"
brwWebBrowser.GoSearch
Case "Stop"
timTimer.Enabled = False
brwWebBrowser.Stop
Me.Caption = brwWebBrowser.LocationName
End Select

End Sub

and For the Mdi Form here it is.


Private Sub MDIForm_Load()

End Sub

I'm doing this in my spare time so you don't have to hurry Please and Thank you
From Yoda and all of Canada Eh!
Jan 5 '07 #1
10 3668
Killer42
8,435 Expert 8TB
Code for that i made up doesn't work whats wrong?

Private Sub Command1_Click()
If Command1 Is pressed Then start ProgressBar1
End Sub

that's to start the progress bar but it doesn't.
Is that the actual code you are trying to execute? If this is VB6 then I'd be very surprised to see it pass the syntax-check. I don't think "start" is even a statement, though you could create a sub called "start" and invoke that.

Anyway, you don't start a progress bar. From the moment it is placed on your form, it always displays (assuming it's visible) whatever is appropriate to the value currently in its .Value property. So what do you actually want to do with it when this button is clicked? Set it back to zero?

Keep in mind, the progress bar doesn't actually do any progress tracking for you. It just displays the information you give it, but as a bar instead of text. So if you want it to show the progress of some task, you need to first set .Min and .Max appropriately (I believe they default to 0 and 100 respectively, which is convenient for showing a percentage) and ensure .Value is set to the same as .Min. Then as you go through the task, you set .Value to progressively higher values, until it reaches .Max at the end of the task.

If you are not talking about VB6, then forget everything I said.
Jan 5 '07 #2
yoda
291 100+
Thanks, but could put in lam mans terms, kind get what your saying but would put itin code.

Example:
Private Sub Command1_Click()
If Command1 Is Clicked then .Min = 0
If Command1 is clicked then .max = 100
End Sub

is it like that, just a guest, because right know i'm on my computer that doesn't
have vb 6.0 (i'm on my iMac). I've also got a question does VB come for mac or not.
Jan 5 '07 #3
Killer42
8,435 Expert 8TB
Thanks, but could put in lam mans terms, kind get what your saying but would put itin code.

Example:
Private Sub Command1_Click()
If Command1 Is Clicked then .Min = 0
If Command1 is clicked then .max = 100
End Sub

is it like that, just a guest, because right know i'm on my computer that doesn't
have vb 6.0 (i'm on my iMac). I've also got a question does VB come for mac or not.
I don't think VB is available for Mac, though I believe you can actually run Windows on the Mac now, so that would be one way. Probably not a lot of help, though.

I get the impression that you are struggling with the event-driven nature of VB (and lots of other languages). For a start, the Command1_Click routine is only executed when the user clicks Command1. So there is no need to try to detect whether it was clicked.

Try this...
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2.   ' These first two lines are probably not needed, since 0
  3.   ' and 100 are the defaults.
  4.   ProgressBar1.Min = 0 
  5.   ProgressBar1.Max = 100
  6.  
  7.   ProgressBar1.Value = 0
  8. End Sub
Jan 5 '07 #4
yoda
291 100+
i'm only in high school and we only did a month of programming and now i'm trying to figure it out by myself.

thanks a lot for the code se you later Killer42
Jan 5 '07 #5
yoda
291 100+
Sorry that CODE DIDN'T WORK i have know idea what to try nice please help
even if i clicked it didn't work and it didn't do it automaticly if thats what your saying
when you don't want it to detect if you clicked or not.

sorry if i'm confusing you

thanks dude

Yoda (canada EH)
Jan 5 '07 #6
Killer42
8,435 Expert 8TB
Sorry that CODE DIDN'T WORK i have know idea what to try nice please help
even if i clicked it didn't work and it didn't do it automaticly if thats what your saying
when you don't want it to detect if you clicked or not.
Can you try to explain what it didn't do, that you were expecting it to do?

As I said, the progress bar control just displays whatever number you place in it.
Try this simple example. In a new project, place a progress bar control on your form. Double-click the form to get to the code window, go right to the bottom and paste paste this code...
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Click()
  2.   ProgressBar1.Value = RND * 100 ' Set random value between 0 and 100.
  3. End Sub
When you run it, you should find that every time you click anywhere on the form, the progress bar switches to a different setting.

Hopefully, this will help to illustrate both the use of the click event, and how to display a value in the progress bar.

Maybe you can have a go at changing it from a form click to a button click. :)
Jan 5 '07 #7
yoda
291 100+
First thing it didn't do was even show that the progress bar was doing anything and even if i clicked on the button it wouldn't work.

Tried the one you just gave me but how do you get it not Random. I took that out it it didn't even work at all.

Example I did this:

Private Sub Form_Click()
ProgressBar1.Value = 0 * 100 ' Set value between 0 and 100.
End Sub

but i get the idea now. First you don't need "Private Sub Form_Click()"

You need:

Private Sub ProgressBar1_MouseDown(Button As Integer, Shift As Integer, x
As Single, y As Single)
ProgressBar1.Value = Rnd * 100 ' Set random value between 0 and 100.
End Sub
you get the point

And thanls for helping me but not giving me the Answers.

Yoda (Canada Eh)
Jan 5 '07 #8
yoda
291 100+
Hey Killer i got it to work due hope i will see you if i have any questions on VB 6.0


Thanks Alot

Yoda Canada Eh
Jan 5 '07 #9
Killer42
8,435 Expert 8TB
but i get the idea now. First you don't need "Private Sub Form_Click()"

You need:

Private Sub ProgressBar1_MouseDown(Button As Integer, Shift As Integer, x
As Single, y As Single)
Oops! VB version problem. :) My code works in VB6.

Anyway, glad to see you've got it worked out.
Jan 6 '07 #10
willakawill
1,646 1GB
Oops! VB version problem. :) My code works in VB6.

Anyway, glad to see you've got it worked out.
I love it :)
Our friend yoda has been sent from on high to test levels of patience. Congratulations Killer, you have it in buckets :)
Jan 7 '07 #11

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

Similar topics

3
by: Canes_Rock | last post by:
The information posted at: ...
0
by: Martin Platt | last post by:
Hi, I'm looking into various options for a fairly simple backup utility for our application. I have no problems being able to backup, find restorable backup files, and restore then. What I'd...
19
by: trint | last post by:
Ok, I start my thread job: Thread t = new Thread(new ThreadStart(invoicePrintingLongRunningCodeThread)); t.IsBackground = true; t.Start(); There are lots of calls to controls and many...
3
by: SpamProof | last post by:
I got an animated gif that is a barber pole spinning that I want to use as a progress bar. The problem is that is stops spinning (shows 1 frame) when my browser is processing a submited request...
16
by: Crirus | last post by:
Hi there! This is the problem: I have a server that accept connections. Each request span a thread that handle it. I need a way to store the client IP's. If the requests made from a single IP...
13
by: mark | last post by:
I have a sub which needs to do some things then wait a specified length of time before going on. I tried adding a timer with counter in its tick event then checking the state of the counter in the...
46
by: Bruce W. Darby | last post by:
This will be my very first VB.Net application and it's pretty simple. But I've got a snag in my syntax somewhere. Was hoping that someone could point me in the right direction. The history: My...
0
by: jags_32 | last post by:
Hello We use MFG-PRO as our ERP system which in turn uses Progress databases. In the old version of SQL 2000, using DTS packages, we used to set the code page via command prompts and execute DTS...
0
by: gojners | last post by:
I need to go through a set of tasks. Each task has a priority (low/medium/high) and a status (Open/In progress/Closed). Each task also has a membership (Internal/External/Other). My problem is...
2
by: mikelis | last post by:
I have a main form that does a lengthy database query. Before I fire off the query, I need to pop up another form that contains a progress bar and a Close button. The progress bar updates for 30...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.