Hello I am new here as well as with vb2008xpress and I have a question. I have a datagridview with 12 columns and 30 rows I want to use as a scoreboard for a game (no need to input or save data). Columns are for the players and rows for the scores of each turn played. Say player1 has a score of 10 I type it in in his column in row1, the 10 should show up in a label as his total. His next turn his score is 100, type it in row2 and the label should show 110 as total. Hope I am clear enough, is there anyone able to give an idea on how to do this (in code if possible)? Thanx Gé

Assuming that your DataGridView is called dgv, then this should do the trick.

Private Sub dgv_CellValueChanged(ByVal sender As Object, ByVal e As DataGridViewCellEventArgs) Handles dgv.CellValueChanged
        For i As Integer = 0 To dgv.Rows.Count - 1
            lblPlayerScore1.Text += dgv.Rows(i).Cells(0)
            lblPlayerScore2.Text += dgv.Rows(i).Cells(1)
            lblPlayerScore3.Text += dgv.Rows(i).Cells(2)
            lblPlayerScore4.Text += dgv.Rows(i).Cells(3)
            lblPlayerScore5.Text += dgv.Rows(i).Cells(4)
            lblPlayerScore6.Text += dgv.Rows(i).Cells(5)
            lblPlayerScore7.Text += dgv.Rows(i).Cells(6)
            lblPlayerScore8.Text += dgv.Rows(i).Cells(7)
            lblPlayerScore9.Text += dgv.Rows(i).Cells(8)
            lblPlayerScore10.Text += dgv.Rows(i).Cells(9)
            lblPlayerScore11.Text += dgv.Rows(i).Cells(10)
            lblPlayerScore12.Text += dgv.Rows(i).Cells(11)
        Next
    End Sub

Hi Oxiegen thanx for your reply I have been able to figure out something for myself but your code looks easier so I am gonna try it thanx again Gé

hi i'm new in vb 6.0 and iwant to know how adding the value in the fields works .pls help me on how to add all the value in a specific fields in the datagrid using vb 6.0??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.