[ad_1]
I’m trying to cumulate the values of an array, grouping by the ID of column14.
My code looks like this:
Dim chartValues = New Dictionary(Of String, Decimal)()
For Each row In DataGridView1.Rows.OfType(Of DataGridViewRow)
Dim column14Value = row.Cells().Item("Column14").Value.ToString()
Dim column11Value = row.Cells().Item("Column11").Value
If (chartValues.ContainsKey(column14Value)) Then
chartValues(column14Value) = chartValues(column14Value) + column11Value
Else
chartValues.Add(column14Value, column11Value)
End If
Next
For Each chartValue In chartValues
Dim Tot As Decimal
Tot += chartValue.Value
ComboBox1.Items.Add(Tot)
Next
My problem is that the order of the values in the array is in disorder, I need to sort it descending (for a Pareto) but I dont know how to do this. (The cumulate by it self it those works)
Any help is really appreciated. Thanks!
[ad_2]