error "Index was outside the bounds of the array"
I have a datatgrid with datasource of type Dataset (connected by SetDataBinding(ds, table_name).
Sometimes when I click on a row (uaually after resize a column or scroll the grid), I get this error message: "Index was outside the bounds of the array",
and the debugger points of the declaration of the form that starts the project.
Why is it happens and how to avoid this?
There is no 'Details' button in this case
I know what you mean, because I saw this button in many error messages before, but in this case the error message does not contain this button.
Doesn't anyone knows this datagrid problem?
:(
I found the code that cause the problem
But I still don't understand why!
it's:
Dim hi As System.Windows.Forms.DataGrid.HitTestInfo
hi = datagrid1.HitTest(e.X, e.Y)
datagrid1.CurrentRowIndex = hi.Row
I get the error after resizing a grid column, and then click any grid cell.