Removing Selected Rows

I have a remove button on a form that lets the user remove multiple selections of rows. What would be the best way to do this. I have tried GridRangeInfoList r = gridControl1.Selections.GetSelectedRows(true, true); this gets me the range but I can't seem to get the index (int) of the rows. Please tell me what is the best way of removing multiple selections of rows.

2 Replies

LU Luc September 23, 2003 04:28 PM UTC

> I have a remove button on a form that lets the user remove multiple selections of rows. What would be the best way to do this. I have tried GridRangeInfoList r = gridControl1.Selections.GetSelectedRows(true, true); this gets me the range but I can't seem to get the index (int) of the rows. Please tell me what is the best way of removing multiple selections of rows. > I answered my own question. Here is what I did for those that are interested. foreach(GridRangeInfo r in gridControl1.Selections.GetSelectedRows(true,true)) { gridControl1.Rows.RemoveRange(r.Top, r.Bottom); } the r.top and r.bottom did not do what I though they did.


AD Administrator Syncfusion Team September 23, 2003 08:37 PM UTC

Try to reverse looping throw the ranges, e.g. GridRangeInfoList ranges = gridControl1.Selections.GetSelectedRows(true,true); for (int n = ranges.Count-1; n>= 0; n--) gridControl1.Rows.RemoveRange(ranges[n].Top, ranges[n].Bottom); Stefan

Loader.
Up arrow icon