I came up with this method of figuring out how long it'll take for my program to run through a ton or records (up to 500K). It works pretty well I think, but I'm interested in seeing what other ways people can come up with.
iFileNR = Number of Records In File
might help if I had the everything that's involved with it postedVB Code:
'Timer Refresh Dim RCTimer As String Dim RCTimerOLD As String Dim SecondsLeft As String Dim aveDiff As Long Dim aveDiffCount As Integer Dim iTotalTime As Integer 'Progress Bar Refresh Dim pbPercent As String Dim pbTime As String Dim pbGBW As Integer Dim wHalf As Integer Private Sub SampleFunction() RC = 0 Do Until EOF(1) UpdateProgressBar RC 'Call Function Seek #1, ((RC * RecordLength) + 1) Get #1, , Record RC = RC + 1 RCTimer = RC Loop End Sub Private Sub tmrProgressBar_Timer() Difference = Val(RCTimer) - Val(RCTimerOLD) aveDiff = aveDiff + Difference If aveDiff <> 0 Then aveDiffCount = aveDiffCount + 1 Difference = Round((aveDiff / aveDiffCount), 0) LeftOvers = iFileNR - RCTimer IntervalsLeft = LeftOvers / Difference TimeLeft = IntervalsLeft * tmrProgressBar.Interval tmpSecondsLeft = TimeLeft / 1000 SecondsLeft = Round(tmpSecondsLeft, 0) RCTimerOLD = RCTimer End Sub Private Sub UpdateProgressBar(RC As Long) 'Time Remaining Display If (Val(SecondsLeft) Mod 60) < 10 Then FormatedSeconds = "0" & (Val(SecondsLeft) Mod 60) Else FormatedSeconds = (Val(SecondsLeft) Mod 60) NewTime = (Val(SecondsLeft) \ 60) & ":" & FormatedSeconds pbTime = NewTime End Sub![]()




Reply With Quote