Hi Brian,
I've tried this code with the latest version (2.4.4) of the XtraGrid and it
worked fine for me. Please check that you are using the latest version of
the XtraGrid and if it still doesn't work, please send a sample project to
our support team.
--
Alex
R&D, .NET Team
Developer Express Inc.
PS. Please don't reply to me by email directly unless it is specifically
requested.
If you wish to receive direct assistance from our Support Team, feel free to
contact us at Support@DevExpress.com.
"Brian Hansen" <bsh@git.dk> wrote in message
news:418a2777$1@news.devexpress.com...
> After removing the 2 rows the FocusedRowHandle is 1 even though there is
> only 1 row left in the grid and therefore should be 0.
>
> Can anyone help me on this??
>
> "Brian Hansen" <bsh@git.dk> skrev i en meddelelse
> news:4188f851@news.devexpress.com...
>> Hi
>>
>> I'm trying to delete some rows from a grid. I use the following code
> (taken
>> from the help)
>>
>> private void DeleteRows()
>>
>> {
>>
>> int[] selectedRows = GridView.GetSelectedRows();
>>
>> if(selectedRows != null)
>>
>> {
>>
>> try
>>
>> {
>>
>> GridView.BeginUpdate();
>>
>> Array.Sort(selectedRows);
>>
>> for (int i=selectedRows.Length-1; i>=0; --i)
>>
>> {
>>
>> GridView.DeleteRow(selectedRows[i]);
>>
>> }
>>
>> }
>>
>> finally
>>
>> {
>>
>> GridView.EndUpdate();
>>
>> }
>>
>> }
>>
>> }
>>
>> I have a Grid with a DataSource with 3 rows. If I select row no. 1 and 3
> in
>> that order and invokes the method, then I can't select the remaining row.
> I
>> get a DialogBox saying "Index was out of range. Must be non-negative and
>> less than the size of the collection. Parameter name: index Do you want
>> to
>> correct the value ?".
>>
>> If I select row no. 3 and then no. 1 there is no problem!
>>
>> What am I doing wrong??
>>
>>
>>
>> Thanks for your help!
>>
>> Brian
>>
>>
>
>