Results 1 to 9 of 9

Thread: [RESOLVED] Percentage counter?

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    Poulsbo, WA
    Posts
    60

    Resolved [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?

  2. #2
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: Percentage counter?

    Why don't you use a progress bar?

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    Poulsbo, WA
    Posts
    60

    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.

  4. #4
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: Percentage counter?

    Quote 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

  5. #5

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    Poulsbo, WA
    Posts
    60

    Re: Percentage counter?

    That's the root of the problem, the total number of records different every time.

  6. #6
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Percentage counter?

    Post your code. You can use a variable instead of a number for .Max

  7. #7

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    Poulsbo, WA
    Posts
    60

    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?

  8. #8

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    Poulsbo, WA
    Posts
    60

    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

  9. #9

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    Poulsbo, WA
    Posts
    60

    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
  •  



Click Here to Expand Forum to Full Width