Hi all,
I have a datagridview on my desktop application, what I need is to show in a a textbox the sum of collums values, of rows selected manually. Is this possible??????
Can you guys help me on this?
Printable View
Hi all,
I have a datagridview on my desktop application, what I need is to show in a a textbox the sum of collums values, of rows selected manually. Is this possible??????
Can you guys help me on this?
which columnIndex contains the numeric value?
try this (uses column 0):
vb Code:
Private Sub DataGridView1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGridView1.SelectionChanged TextBox1.Text = (From row As DataGridViewRow In DataGridView1.Rows.Cast(Of DataGridViewRow)() _ Where row.Selected = True _ Select CInt(row.Cells(0).Value)).Sum.ToString End Sub
The DataTable.Compute Method might help.
Very good guys, it worked very well, thanks a lot.