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.