Chinmaya Dash

Chinmaya Dash

  • 938
  • 1.1k
  • 49.3k

Windows Form Screen frozing while calling Db.

Sep 20 2017 11:49 AM
Hi There,
 
 Windows Form Screen frozing while calling Db in button click to load data in Datagrid.
Taking 5 min of time to load the data in between that screen is frozing.
Some how i have implemented Asyn(Threading) process after that data is loading Data Grid Scroll bars are not working.
 
Please see my code bellow
 
 
 Dim mk As MethodInvoker = Sub()
CheckForIllegalCrossThreadCalls = False
m_RollSortableList = New SortableBindingList(Of Global.Clopay.Gsf.Entities.QualityManagementDetailView)(RollDetailModel.GetAllFilteredMaterial(txtItemNumber.Text.Trim, txtMachineName.Text.Trim, txtJobNumber.Text.Trim, txtLotNumber.Text.Trim, reasonCodes, quality, txtLPN.Text.Trim, rolldata, txtLocation.Text.Trim))
m_RollBindingSource.DataSource = m_RollSortableList
dgvRollSets.DataSource = Nothing
dgvRollSets.Columns.Clear()
If Me.InvokeRequired Then
Me.BeginInvoke(New MethodInvoker(AddressOf RefreshDisplay))
Else
RefreshDisplay()
End If
dgvRollSets.DataSource = m_RollBindingSource
End Sub
mk.BeginInvoke(AddressOf callbackfunction, Nothing)
 
 
 
Thanks in advance.
 
 
 
 
 

Answers (1)