I have some trouble with setting the last row in my datagridview selected. I select the last row this way:
if (grid.Rows.Count > 0)
{
try
{
gr
Your 'catch' block for IndexOutOfRangeException is empty, and will not display any error at all.
Either your question is not exact, or the exception is being thrown somewhere else.
EDIT: Having looked through your call stack that you added, I can see that the error is, indeed, not being thrown here, but rather in the CurrencyManager
class's Current
/Item
properties, which is ultimately being triggered by the call to the CurrentCell
setter.
Bottom line: the problem is not in this code; the exception is being thrown by some other piece of code triggered by your setting the current cell.