REQUEST A DEMO

Simplification

Just replaced this VB (shudder) code

' Build up additional info string using
'  research time as formatted string
addnl_info = "Elapsed time = "
t_long = research_time
If t_long > 86400 Then
	t_long2 = t_long  86400
Else
	t_long2 = 0
End If
t_long = t_long - t_long2 * 86400
addnl_info = addnl_info & VB6.Format(t_long2, "000") & " "
If t_long > 3600 Then
	t_long2 = t_long  3600
Else
	t_long2 = 0
End If
t_long = t_long - t_long2 * 3600
addnl_info = addnl_info & VB6.Format(t_long2, "00") & ":"
If t_long > 60 Then
	t_long2 = t_long  60
Else
	t_long2 = 0
End If
t_long = t_long - t_long2 * 60
addnl_info = addnl_info & VB6.Format(t_long2, "00") & "."

With this VB (shudder) code:

addnl_info = "Elapsed time = " & GetElapsedTime(research_time) & "."

...

Private Function GetElapsedTime(ByVal researchTimeInSeconds As Integer) As String

	Dim timeSpan As TimeSpan = timeSpan.FromSeconds(researchTimeInSeconds)

	Return String.Format("{0:000} {1:00}:{2:00}", timeSpan.Days, timeSpan.Hours, timeSpan.Minutes)

End Function

Ah that’s better.