|
-
Feb 1st, 2006, 12:27 PM
#1
Thread Starter
Member
[RESOLVED] Percentage counter?
My application opens files with varying numbers of records(3458 or 6490, etc) and then loops through them to find certain ones to be used(67, 900, 45, etc).
How can I make a counter for the status bar that increments to 100 with differing numbers of total records as the 100 value?
-
Feb 1st, 2006, 12:43 PM
#2
Re: Percentage counter?
Why don't you use a progress bar?
-
Feb 1st, 2006, 12:51 PM
#3
Thread Starter
Member
Re: Percentage counter?
Sorry, my confusion. I am using a progress bar. but when I increment by one, it doesn't fill to the 100 percent point correctly.
-
Feb 1st, 2006, 12:59 PM
#4
Re: Percentage counter?
 Originally Posted by KidJavelin
Sorry, my confusion. I am using a progress bar. but when I increment by one, it doesn't fill to the 100 percent point correctly.
You know how many record it would be?
Example, it they are 40000
Code:
Private Sub Form_Load()
ProgressBar1.Max = 40000
End Sub
Then each time you process one of them..
Code:
ProgressBar1.Value = ProgressBar1.Value + 1
-
Feb 1st, 2006, 01:01 PM
#5
Thread Starter
Member
Re: Percentage counter?
That's the root of the problem, the total number of records different every time.
-
Feb 1st, 2006, 01:02 PM
#6
Re: Percentage counter?
Post your code. You can use a variable instead of a number for .Max
-
Feb 1st, 2006, 01:11 PM
#7
Thread Starter
Member
Re: Percentage counter?
This is where the counter gets initialized. I tried using a variable, but it didn't work.
If Filename = "" Then
Form1.NewRcd.Visible = True
Form1.OpenFile.Visible = True
Exit Sub
Else
Filenum = FileOpener(Filename, READFILE, 122, Confirm)
Form4.Caption = Filename
Form8.Label7.Caption = Filename
totrcds% = (LOF(Filenum) / 122)
Form8.Label8.Caption = Str(totrcds%)
Form8.ProgressBar1.Max = totrcds%
Form1.CloseFile.Visible = True
oflag% = 1
Initialize
SetShow
An then to increment it I tried Form8.ProgressBar1.Value + 1. That got the progress bar to go maybe halfway to 100.
Did you need more code than that?
-
Feb 1st, 2006, 01:25 PM
#8
Thread Starter
Member
Re: Percentage counter?
This is how it gets incremented. I should've posted this as well, sorry.
Do
If last_rcd = 0 Then 'filenum > 0 Then
ShowRecord '(last_rcd)
wc = Nsnap.SF1
I% = CkKeyWC(wc)
If ((I% = 0) And (Form4.Check1.Value = 1)) Or ((NoSupport$ = "yes") And (Form4.Check3.Value = 0)) Then
If nextjcn% = JCNcnt1% + 1 Then
JCNcnt1% = nextjcn%
Else
nextjcn% = JCNcnt1% + 1
SkipIt$ = "Y"
End If
ElseIf nextjcn% > JCNcnt1% Then
nextjcn% = JCNcnt1% + 1
SkipIt$ = "Y" ' Auto skip forward
Else
SkipIt$ = "N" '
nextjcn% = JCNcnt1%
End If
End If
Form8.ProgressBar1.Value = Form8.ProgressBar1.Value + 1
Loop Until SkipIt$ = "N" Or last_rcd = 1
-
Feb 2nd, 2006, 09:34 AM
#9
Thread Starter
Member
Re: Percentage counter?
Does it matter if these snippets are located in two different functions?
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
|