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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Combine Selected Ranges

Thread ID:





29324 May 23,2005 04:04 PM UTC May 23,2005 05:12 PM UTC WinForms 1
Tags: GridControl
Asked On May 23, 2005 04:04 PM UTC

If I select cell A1, and then select B1 using ctrl mouse click: 2 ranges are returned from the Grid.Selections.GetSelectedRanges method. Since these two ranges appear as 1, I would like to simply combine these ranges (A1:B1) or get the combined range from a SF method. How could I accomplish this? Thanks, Steve

Administrator [Syncfusion]
Replied On May 23, 2005 05:12 PM UTC

The GridRangeInfo object does have helper methods like UnionRange that you can use to actually do the work, but there is nothing that I can think of in our library to help you decide whether you want to merge two ranges or not. You could handle the grid1.Model.SelectionChanged event. It has a e.Range with the new selection and an e.OldRanges with the old selections. You could iterate through the old selections of see if you can find a match for the new selection. If so, remove both the old selection and the new selection and replace it with a union of the 2. This would take a little coding, and you may have to check for recursive calls in SelectionChanged as the result of you adding a new selected range in the handler.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon