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?