davidegironi / advanceddatagridview

A .NET WinForms DataGridView with advanced capabilities
392 stars 123 forks source link

filter button_click events #125

Closed rezarahimy closed 11 months ago

rezarahimy commented 11 months ago

I want after the select item in combo and click Filter button immediately calculate sum of one column value

davidegironi commented 11 months ago

Hello,

if you mean having a raw with the total value, you have to post/compute that, and add to the dataset. The feature you are asking is not part of advanced data grid view.

rezarahimy commented 11 months ago

Hello, thank you very much for your reply I want to have the sum of column 9 after filtering column 2 At the same time as clicking the filter button, the sum event is done and I don't have to define a new button and click for sum Best Regards

Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Try

SpGetHotelRevenueTableAdapter.Fill(Lotus_foDataSet.spGetHotelRevenue, MaskedTextBox1.Text, MaskedTextBox2.Text) TextBox1.Text = AdvancedDataGridView1.RowCount Catch ex As System.Exception System.Windows.Forms.MessageBox.Show(ex.Message) End Try End Sub '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' this sub not work Private Sub AdvancedDataGridView1_FilterStringChanged(sender As Object, e As Zuby.ADGV.AdvancedDataGridView.FilterEventArgs) Handles AdvancedDataGridView1.FilterStringChanged TextBox1.Text = AdvancedDataGridView1.Rows.GetRowCount(DataGridViewElementStates.Visible) TextBox2.Text = FormatNumber((From row As DataGridViewRow In AdvancedDataGridView1.Rows.Cast(Of DataGridViewRow)() Select CDec(row.Cells(9).Value)).Sum, 0) End Sub 'this sub not work '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click TextBox1.Text = AdvancedDataGridView1.Rows.GetRowCount(DataGridViewElementStates.Visible) TextBox2.Text = FormatNumber((From row As DataGridViewRow In AdvancedDataGridView1.Rows.Cast(Of DataGridViewRow)() Select CDec(row.Cells(9).Value)).Sum, 0)

End Sub

End Class

On Thu, Dec 14, 2023 at 10:30 AM Davide Gironi @.***> wrote:

Closed #125 https://github.com/davidegironi/advanceddatagridview/issues/125 as completed.

— Reply to this email directly, view it on GitHub https://github.com/davidegironi/advanceddatagridview/issues/125#event-11244170448, or unsubscribe https://github.com/notifications/unsubscribe-auth/A4CRS2UE4J4SM3YKGYWN3HTYJKPZ3AVCNFSM6AAAAABAUHKODKVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJRGI2DIMJXGA2DIOA . You are receiving this because you authored the thread.Message ID: <davidegironi/advanceddatagridview/issue/125/issue_event/11244170448@ github.com>

davidegironi commented 11 months ago

It's something out of the advanceddatagridview context. That is functional code you have to write in your own application. I would add an event to the underling bindingsource (ListChanged), rather than filterstrinchanged, anyway that's up to you.

rezarahimy commented 11 months ago

Thanks for the tip!

On Sat, Dec 16, 2023 at 5:13 PM Davide Gironi @.***> wrote:

It's something out of the advanceddatagridview context. That is functional code you have to write in your own application. I would add an event to the underling bindingsource (ListChanged), rather than filterstrinchanged, anyway that's up to you.

— Reply to this email directly, view it on GitHub https://github.com/davidegironi/advanceddatagridview/issues/125#issuecomment-1858821877, or unsubscribe https://github.com/notifications/unsubscribe-auth/A4CRS2Q4OWFDYDCKLLRPOBTYJWQOJAVCNFSM6AAAAABAUHKODKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJYHAZDCOBXG4 . You are receiving this because you authored the thread.Message ID: @.***>