Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15038

VS 2019 [RESOLVED] DateTime.Now.Substract

$
0
0
I index files using a BackgroundWorker. When finished I want to display the time the process lasted. Even when indexing takes less then one minute I get a time like:
63754024013,3167 sec.


Code:

ReadOnly dtt As Date
Dim dtt As Date = Now
            BackgroundWorker1.RunWorkerAsync()

Private Sub BackgroundWorker1_RunWorkerCompleted(sender As Object, e As RunWorkerCompletedEventArgs) Handles BackgroundWorker1.RunWorkerCompleted

        Dim StopTime As Date = Now
        Dim ts As TimeSpan = StopTime - dtt
        PictureLoading.Visible = False
        ToolStripStatusLabel1.Text = "Finished indexing in " + DateTime.Now.Subtract(dtt).TotalSeconds.ToString + " sec."
    End Sub


Viewing all articles
Browse latest Browse all 15038

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>