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.
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?
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.