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é
Jump to Post
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) …
All 3 Replies
Be a part of the DaniWeb community
We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.