A multithreading exception has occurred

  • Thread starter Thread starter NachoShaw
  • Start date Start date
N

NachoShaw

Guest
Hey

I added a datagrid view to a new usercontrol which i added to a panel on my form so that i could visually review the data before i processed it. The underlying table is a dataview from a table-

Private Sub GridControlIdentifer_Click(sender As Object, e As EventArgs) Handles GridControlIdentifer.Click


Dim GetID As String = GridViewDataName.GetFocusedRowCellValue(GridViewDataName.Columns(0))
Dim dv As DataView = New DataView(AddinGlobal.FrmLoader.Tables.XMLTable) With {
.RowFilter = "cID = " & GetID
}

GridControlDataReview.DataSource = dv

End Sub



My process is to load a XML file and get the data from it. I can do this multiple times over and over while i do not view the datagrid. Once i view it and the panel changes to show the datagrid, i get this error if i load the xml file

'A multithreading exception has occurred'

I havent seen this before and i only get it once i have viewed the data grid'

So

load xml file - no error

load another xml file - no error

view data in datagrid

load another xml file - error

i cant see where the error is originating. The xml data is loaded into the table using a BackGroundWorker as below

Private Sub BackgroundWorker1_DoWork(sender As Object, e As DoWorkEventArgs) Handles BackgroundWorker1.DoWork

Tables.ClearTables()

'load file data into table
'Dim Data As New Data
Data.PopulateTable()

UsrReview.GridControlDataReview.DataSource = Tables.XMLTable

End Sub

i have a RunWorkerCompleted that fires so i feel confident that the BackgroundWorker is completing. Could the issues be in the Data.PopulateData? all trhat does is open an xml file, read the data and adds it to a table then closes the XML but maybe i need to look at that?


what is the usual / typical cause of this kind of issue?



Thanks




I am here to ask questions and learn from others. Cor Ligthert DO NOT REPLY TO ANY OF MY POSTS!!

Continue reading...
 
Back
Top