Hi,
I have a datagridview in my application with numeric columns and date column. This datagridview is filtered by date. I want a label to show the sum of the filtered rows.
Can you help me?
Printable View
Hi,
I have a datagridview in my application with numeric columns and date column. This datagridview is filtered by date. I want a label to show the sum of the filtered rows.
Can you help me?
Are you binding the DataGridView? How are you filtering the rows?
Yes I am. Please find below the code:
ThanksCode:
Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged
Dim strData As String
strData = DateTimePicker1.Text
Me.CadastroSeqBindingSource.Filter = "Data = '" + strData + "'"
Me.CadastroSeqTableAdapter.Fill(Me.Db01DataSet.CadastroSeq)
End Sub
E.g.vb.net Code:
Dim sum = CInt(Me.Db01DataSet.CadastroSeq.Compute("SUM(SomeColumn)", Me.CadastroSeqBindingSource.Filter)
Wawww, It works very well, thank you.