0

When selecting from DataGridView as program line below:

Diameter = DesignationsDataGridView.Rows(e.RowIndex).Cells(0).Value

I get following exception message box:-

System.ArgumentOutOfRangeException was unhandled
Message="Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index"

If I select 'continue' from message box then I return to datagridview for further attempt.

Please can anyone tell me how to deal with this exception? (other than not to click on header, of course)

2
Contributors
2
Replies
9
Views
3 Years
Discussion Span
Last Post by Centorpe
0
If e.RowIndex.ToString > -1 Then
Diameter = DesignationsDataGridView.Rows(e.RowIndex).Cells(0).Value
endif
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.