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.
Unfortunately, activation email could not send to your email. Please try again.

Combine Selected Ranges

Thread ID:

Created:

Updated:

Platform:

Replies:

29324 May 23,2005 12:04 PM May 23,2005 01:12 PM Windows Forms 1
loading
Tags: GridControl
Steve
Asked On May 23, 2005 12:04 PM

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 01:12 PM

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.

CONFIRMATION

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.

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.

;