The problem that arises is the following:
When I change the BindingSource
of a DataGridView
in vb.net
in a BackgroundWorker
, I get the following error:
system indexoutofrangeexception index 0 does not have a value, in System.Windows.Forms.CurrencyManager.gey_Item (Int32idex) in System.Windows.Forms.DataGridView.DataGridViewDataConection.GetError (Int32 rowIndex "
The error does not always jump, there are times when it works correctly, but when I make the change often, the error jumps in. Does anyone know why? How to solve the error? The bindingsource is updated by a datatable by a query something like this:
Dim b as new bindingsource
dim data as new datatable
dim datagrid as new datagridview
datagrid.datasource = b
b.datasource = data
AddHandler aplicarndocambios.DoWork, AddressOf procesoderellenado
Public aplicarndocambios As System.ComponentModel.BackgroundWorker = New System.ComponentModel.BackgroundWorker
Sub procesoderellenado()
dim adap as new mysqldataadapter ("consulta")
adap.Fill(data)
end sub
In the adapt part, skip a bit of code, but basically do the query, and update "Data" and it works correctly, the error does not always come out