We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

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.
Live Chat Icon For mobile
Up arrow icon