title: Filling DataGridView from BackgroundWorker
body: <p>This is the case:<br>
  I have a <code>DataGridView</code> in form and when I start the form <code>DGV</code> should start filling with <code>BackgroundWorker</code>.  </p>
  
  <pre><code>Private Sub FirstSub()
      adoconn()
      Me.Enabled = False
      bw.RunWorkerAsync()
      Me.Enabled = True
  End Sub
  
  Private Sub bw_DoWork(sender As Object, e As DoWorkEventArgs) Handles bw.DoWork
  
      Dim worker As BackgroundWorker = CType(sender, BackgroundWorker)
      If DataGridView1.InvokeRequired Then
          '//For VB 10 you can use an anonymous sub
          DataGridView1.Invoke(Sub() bw_DoWork(sender, e))
      Else
  
  
          Try
              DataBaseLayer.FillDTwithSP("ArticlesSelect", ds_Tables.Articles)
              Me.DataGridView1.DataSource = ds_Tables.Articles
              Me.DataGridView1.ClearSelection()
  
          Catch ex As Exception
              MsgBox(ex.ToString)
          End Try
      End If
  
  End Sub
  </code></pre>
  
  <p>After Carlos giving me an example of what should I do, I did this, but now I have a problem that when I place BrakePoint is doesn't even get into <code>bw_DoWork</code> sub</p>
  
  <pre><code>Private Sub FirstSub()
      adoconn()
      Me.Enabled = False
      bw.WorkerReportsProgress = True
      AddHandler bw.DoWork, AddressOf bw_DoWork
      AddHandler bw.ProgressChanged, AddressOf bw_ProgressChanged
      Me.Enabled = True
  End Sub
  Private Sub bw_ProgressChanged(ByVal sender As Object, ByVal e As ProgressChangedEventArgs)
      Try
          DataBaseLayer.FillDTwithSP("ArticlesSelect", ds_Tables.Articles)
              Me.DataGridView1.DataSource = ds_Tables.Articles
              Me.DataGridView1.ClearSelection()
      Catch ex As Exception
          MsgBox(ex.ToString)
      End Try
  End Sub
  Private Sub bw_DoWork(sender As Object, e As DoWorkEventArgs)
      Dim worker As BackgroundWorker = CType(sender, BackgroundWorker)
      bw.ReportProgress(sender, e)
  End Sub
  </code></pre>
  
  <p>So, my desired thing is to disable all controls on form until my <code>DataTable</code> is filled and <code>DataGridView</code> is showing a result set from <code>DT</code>. 
  The thing is that when I load this form it freeze and un-freeze again when everything is done, so there is no effect of <code>BackgroundWorker</code> at all.</p>
  
  <p>If you need any more info or code parts feel free to tell me so I can solve this problem.  </p>
  
  <p>Thanks,<br>
  Hoh</p>