-4

When i Invoke the Event , it throws an error like Index (int)i either negative or above row count.

What can i do.. . public void UserDeletingEvent (object sender, EventArg e) { BindingSource.RemoveAt(e.row.index); }

Pikachu
  • 27
  • 1
  • 6

3 Answers3

1

Check that e.Row.Index is greater than 0, there are reasons that it could be -1 which is an invalid index in the BindingSource.

public void UserDeletingEvent(object sender, EventArg e)
{
    if (e.Row.Index >= 0)
    {
        BindingSource.RemoveAt(e.Row.Index);
    }
}
Trevor Pilley
  • 16,156
  • 5
  • 44
  • 60
0

I found the index did not represent an actual row when the user clicked on the heading or the background area. You have to test that it is a valid index.

Denise Skidmore
  • 2,286
  • 22
  • 51
-2

try pgitems.CurrentPageIndex = PageNumber;

setting that to nothing made it work for me, im building pagig for repeater, done the job