title: Why is my invoke adding 10 seconds onto grid loading time?
body: <p>I've attempted to add a method invoker to stop my error log being spammed with &quot;Bounds cannot be changed while locked.&quot;</p>
  <p>This has solved my issue, however...It has added an extra 10 seconds onto the loading time of my RadGridView.</p>
  <p>I looked at <a href="https://www.telerik.com/forums/bounds-cannot-be-changed-while-locked" rel="nofollow noreferrer">https://www.telerik.com/forums/bounds-cannot-be-changed-while-locked</a> to setup my invoker but there isn't much else that I can see to help with my issue.</p>
  <p>I've attached a sample of my code below, any help would be appreciated.</p>
  <pre><code>Private Sub bgw_initialLoad_DoWork(sender As Object, e As DoWorkEventArgs)
          Try
              liveDS = New DataSet
              Dim dsholder As DataSet = GetDataFromSQL(&quot;LoadData&quot;)
  
              Dim dt1 As DataTable = dsholder.Tables(0)
              Dim dt_1 As DataTable = dt1.Copy()
              dt_1.TableName = &quot;Customer&quot;
              liveDS.Tables.Add(dt_1)
  
              Dim dt2 As DataTable = dsholder.Tables(1)
              Dim dt_2 As DataTable = dt2.Copy()
              dt_2.TableName = &quot;Orders&quot;
              liveDS.Tables.Add(dt_2)
  
              Dim dt3 As DataTable = dsholder.Tables(2)
              Dim dt_3 As DataTable = dt3.Copy()
              dt_3.TableName = &quot;OrderLine&quot;
              liveDS.Tables.Add(dt_3)
  
              If RadGridView.InvokeRequired Then
                  RadGridView.Invoke(New MethodInvoker(AddressOf SetupDataSources))
              Else
                  SetupDataSources()
              End If
          Catch ex As Exception
              sendCaughtError(ex)
          End Try
      End Sub
  
      Private Sub SetupDataSources()
          If liveDS.Tables.Count &gt; 1 Then
              RadGridView.DataSource = liveDS.Tables(&quot;Customer&quot;)
              liveOrdersTemplate.DataSource = liveDS.Tables(&quot;Orders&quot;)
              liveOrdersTemplate2.DataSource = liveDS.Tables(&quot;OrderLine&quot;)
          End If
      End Sub
  
      Private Sub bgw_initialLoad_RunWorkerCompleted(sender As Object, e As RunWorkerCompletedEventArgs)
              Try
                  RadGridView.DataSource = liveDS.Tables(&quot;Customer&quot;)
      
                  Dim template As New GridViewTemplate()
                  template.DataSource = liveDS.Tables(&quot;Orders&quot;)
                  RadGridView.MasterTemplate.Templates.Add(template)
      
                  Dim template2 As New GridViewTemplate()
                  template2.DataSource = liveDS.Tables(&quot;OrderLine&quot;)
                  RadGridView.Templates(0).Templates.Add(template2)
      
                  Dim relation As New GridViewRelation(RadGridView.MasterTemplate)
                  relation.ChildTemplate = template
                  relation.ParentColumnNames.Add(&quot;Invoice Customer&quot;)
                  relation.ChildColumnNames.Add(&quot;InvoiceCode&quot;)
                  RadGridView.Relations.Add(relation)
      
                  Dim relation2 As New GridViewRelation(RadGridView.Templates(0))
                  relation2.ChildTemplate = template2
                  relation2.ParentColumnNames.Add(&quot;OrderNo&quot;)
                  relation2.ChildColumnNames.Add(&quot;OrderNo&quot;)
                  RadGridView.Relations.Add(relation2)
      
                  FormatGrid()
                  SplitContainer2.Panel1.Enabled = True
                  SplitContainer1.Panel2.Enabled = True
                  refreshMainGrid()
                  HideLoadingGif()
              Catch ex As Exception
                  sendCaughtError(ex)
              End Try
          End Sub
  </code></pre>