Learning this VB.NET stuff and I am still not sure how to notify properly the user when exporting to excel has started and when it has finished.
I have this code:
I tried with this "finished" boolean flag but the window gets stuck until the export has finished, which is not what I want. Why do i use thread in the first place if it freezes the window thread.Code:Dim finished as Boolean = true private sub exportToExcel() ' exporting code end sub Private Sub exportToExcelBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exportToExcelBtn.Click finished = False statusBarTB.Text = "Exporting data to Excel file. " thread = New System.Threading.Thread(AddressOf exportToExcel) thread.Start() While Not thread.IsAlive statusBarTB.Text = "Finished recording data to Excel file! " End While End Sub
How can I properly notify user when thread has started and has finished?
Does VB.NET Threading API have stuff like addEventListener with which I can add functions and execute those on certain events?




Reply With Quote
