Results 1 to 3 of 3

Thread: Help with progressbar and counter label

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2010
    Location
    San Marcos, TX
    Posts
    177

    Help with progressbar and counter label

    here's my code:

    Code:
    Private Sub btnBeginScan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBeginScan.Click
            Dim db As New byrndbDataContext
    
            For Each pdffile In strPDFFiles
                strImagesScanned += 1
                pbScan.Value += 1
                lbImagesScanned.Text = strImagesScanned
                Dim info As New FileInfo(pdffile)
            Next
            For Each tiffile In strTIFFiles
                strImagesScanned += 1
                pbScan.Value += 1
                lbImagesScanned.Text = strImagesScanned
                Dim info As New FileInfo(tiffile)
            Next
    
            lbNewImages.Text = strNewImages
        End Sub
    The progressbar runs perfectly, but the lbImagesScanned.Text isn't updated until all the scans are completed. Please advice.

  2. #2
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    5,398

    Re: Help with progressbar and counter label

    You are updating the label after the scans have completed so what do you expect? You can either place lbNewImages.Text = strNewImages inside each for loop or create it's own subroutine and call the update when desired. I would personal use the second option.

    edit* Teach me to glance quickly.

    Have you tired using application.doevents?
    Last edited by ident; Feb 8th, 2012 at 01:04 PM.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2010
    Location
    San Marcos, TX
    Posts
    177

    Re: Help with progressbar and counter label

    I should have taken out the lbNewImages.Text = strNewImages line, it's not the label in which I'm talking about. I'm talking about the lbImagesScanned.Text = strImagesScanned line, it is inside the for each.

    That's why I'm confussed.

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