Ahmad,
By chance are you using a filter? If so, then right before you change your filter, try setting the DataGrid.CurrentRowIndex to zero so it will not be outside the limits of the grid after the filter.
>Dear All,
>
>I am having a strange error:
>((An unhandled exception has occurred in your application. if you click
>continue, the application will ignore this error and attempt to continue
>if you click quit. the application will be shut down immediately.
>
>Index was outside the bounds of the array.))
>
>This error fires, when I add a new row to my data grid.
>
>Any idea what could be the problem?
>
>Thanks in advance.
-----------------------------------------
Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.comwww.prenia.comWeblog: blogs.prenia.com/cathi