Jump to content

[Resolvido] Carregar dados de um Ciclo para DataGrid


Chamuanza

Recommended Posts

Um bem Aja

Tenho um Ciclo executado que me faz a contagem de valores iguais numa Datagrid e pretendo passar os dados para outra Datagrid, mas náo estou a certar com o código.

Alguem me dá uma ajuda?

Private Sub butContar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butContar.Click


Dim ContaNum(50) As Integer
	For i As Integer = 1 To 50
		For Linhas = 1 To DataGridView2.RowCount - 1
			For Colunas = 1 To 5
				If DataGridView2.Item(Colunas, Linhas).Value = i Then
					ContaNum(i) += 1
				End If
			Next Colunas
		Next Linhas
		Me.DataGridView1.Rows.Add()
		Me.DataGridView1.Item(1, i).Value = ContaNum(i)
	Next i

End Sub
Edited by Chamuanza
Link to comment
Share on other sites

- Como faço para dar este Tópico com RESOLVIDO, ainda não consegui perceber

- Como faço para colocar o cabeçalho em negrito ao criar um novo topico

Resolvi este topico com o seguinte código

Dim ContaNum(50) As Integer
    Dim i As Integer

    For i = 1 To 50
	    For Linhas = 1 To DataGridView2.RowCount - 1
		    For Colunas = 1 To 5
			    If DataGridView2.Item(Colunas, Linhas).Value = i Then
				    ContaNum(i) += 1
			    End If
		    Next Colunas
	    Next Linhas
	    ListBox1.Items.Add(i & " - " & ContaNum(i))
	    Tabela.Rows.Add(i, ContaNum(i))
    Next i

Obrigado de qualquer das maneiras

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.