Home Progress bar too fast
Reply: 1

Progress bar too fast

Wayne
1#
Wayne Published in 2018-02-13 20:09:13Z

The progress bar first tracks the copying of files, then the updating of their contents. For some reason the progress bar hits 100% the second time way before the files have all been updated.

Private Sub cmdGenerate_Click(sender As Object, e As EventArgs) Handles cmdGenerate.Click
    Dim CatalogFiles As String() = IO.Directory.GetFiles(dirCatalogues & "\" & cboCatalog.Text, "*"),
        NewFile As String,
        cnt As Integer = 0
    prg.Visible = True
    lblProgress.Visible = True
    Dim dwgs As String() = IO.Directory.GetFiles(dirNewProject, "*.dwg")
    prg.Minimum = 0
    prg.Maximum = dwgs.Length
    prg.Value = 0
    lblProgress.Text = "Updating drawings:"
    For Each dwg In dwgs
        CAD.FindReplace(dwg, strNomenclatureFind, strNomenclatureReplace)
        CAD.FindReplace(dwg, strProjectNameFind, strProjectNameReplace)
        cnt = cnt + 1
        prg.Increment(cnt)
    Next
    MsgBox("Done.")
    ResetForm()
End Sub
galoget
2#
galoget Reply to 2018-02-13 23:11:55Z

You are using prg.Increment(cnt), replace it with prog.Increment(1) since Increment is:

The amount by which to increment the progress bar's current position.

Or replace it with prg.Value(cnt) since Value is:

Gets or sets the current position of the progress bar.

References:

  • Progress Bar Increment
  • Progress Bar Value
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.361826 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO