2017-04-02 4 views
0

의 각 요소의 주파수를 찾는 방법은? 즉 Hello = 4, bye = 3 및 악어 = 2 DataGridView 열에 출력 된 내용을 확인합니다.어떻게 이런 조금 보이는 DataGridView에이 DataGridView에

+0

당신이 칼럼을 통해 반복하고 계산 간주 가지고 나에게 의견을 알려 : 그래서 내 생각은 그것을 할 것입니다? – JohnG

+0

DataTable이 실제로있는 경우 쿼리 할 수 ​​있습니다. – Plutonix

답변

1

아마 Linq도 작동으로 DataGridView하지만 루핑 및 그룹 작성을 조회 할 수있는 더 좋은 방법이 있습니다 도와주세요.

Sub CountRows() 

    Dim lstCountRows as List(Of String) 
    For Each row As DataGridViewRow In MyDataGridView.Rows 
     '2 is the index of the column you are querying 
     lstCountRows.Add(row.Cells(2).Value) 
    Next 
    'Create groups for the values on lstCountRows 
    Dim groups = lstCountRows.GroupBy(Function(value) value) 
    'Loop and print the groups count 
    For Each group In groups 
     MsgBox(group(0) & "-" & group.Count) 
    Next 

End Sub 

이 그것을 시도주고