I'm trying to load data from DB with a BackgroundWorker but I'm getting the follow error:
Quote
Well I didn't created any other thread or call it from other place, my code is just:
Private WithEvents BGW As New BackgroundWorker
Private Sub BGW_DoWork() Handles BGW.DoWork
LoadAll()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
BGW.RunWorkerAsync()
End Sub
Private Sub LoadAll()
Try
Dim query As String = "SELECT * FROM Files"
Dim Adapter As New SQLiteDataAdapter(query, connection)
Dim DSet As New DataSet()
Adapter.Fill(DSet, 0)
Me.DataGridView1.DataSource = DSet.Tables(0)
Catch ex As Exception
MessageBox.Show("Error: " & ex.Message, My.Application.Info.Title, MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub

New Topic/Question
Reply




MultiQuote








|