I made a somewhat large application that works well, except for its UI (winforms) freezes when using webclient to retrieve data from web (link is um... not the fastest), or
never mind. I've got what I wanted with a BackgroundWorker instead:
Public Function GetDatatableUIfree() As DataTable
Dim connection As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\lanserver\storage\DB.accdb;Persist Security Info=False;")
Dim command = connection.CreateCommand()
command.CommandText = "SELECT * FROM bdPROC;"
connection.Open()
Dim retTable As New DataTable, bgw As New BackgroundWorker, bgw_complete As Boolean
AddHandler bgw.DoWork,
Sub(sender As Object, e As DoWorkEventArgs) retTable.Load(command.ExecuteReader)
AddHandler bgw.RunWorkerCompleted,
Sub(sender As Object, e As RunWorkerCompletedEventArgs) bgw_complete = True
bgw.RunWorkerAsync()
Do
Application.DoEvents()
Loop Until bgw_complete
connection.Close()
Return retTable
End Function
Thank you very much anyway for the help.