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

Excel selection sum behavior

I''m trying to code a grid that will do a computation on the selected range (much like Excel does if you select a range: you can sum, count, etc). In the selectionChanged event, I loop through: For Each rngCurrent In grdIDBox.Selections For iCol = rngCurrent.Left To rngCurrent.Right For iRow = rngCurrent.Top To rngCurrent.Bottom If IsNumeric(grdIDBox.Item(iRow, iCol).CellValue) Then dCurrent = CDbl(grdIDBox.Item(iRow, iCol).CellValue) dSum += dCurrent iCountNums += 1 If dCurrent > dMax Or dMax = -1 Then dMax = dCurrent If dCurrent < dMin Or dMin = -1 Then dMin = dCurrent End If If Not CStr(grdIDBox.Item(iRow, iCol).CellValue) = "" Then iCount += 1 End If Next Next Next This works fine on my development machine, but when I compile my application a distribute it, it does not. It only count the last row I select, not all of the ranges.

1 Reply

AD Administrator Syncfusion Team February 11, 2004 02:27 PM

I am not sure why this is working differently on your development machine than on your distribution machine. Are you distributing Syncfusion.Grid.DLL and Syncfusion.Shared.Dll in addition to your exe and other dependent assemblies? Something to try is to use either grid.Selections.Ranges or call grid.Selections.GetSelectedRanges to retrieve the ranges instead of enumerating grid.Selections. Can you submit a sample project showing the problem (either here or through Direct Trac)?

Loader.
Live Chat Icon For mobile
Up arrow icon