Fixed Total Row When Sorting DataGridview

I have DATAGRIDVIEW CALLED ADVANCEDDATAGRIDVIEW
see this link
https://www.nuget.org/packages/DG.AdvancedDataGridView
okay ?
now I Filled this DGV FROM DATATABLE
Here the First Code : DT is A DATATABLE already has data

        With Form1.AdvancedDataGridView1
            .DataSource = DT
            Form1.BindingSource1.DataSource = .DataSource : Endwith  

So now this DGV HAS DATA FROM DT
And I added BindingSource FROM TOOLBOX into Form1 And i Filled it From DATAGRIDVIEW.DataSource

The AdvancedDataGridview has already Filters Icons Like excel in Microsoft Office
But to make it Work You have to Write this Code in FilteringChange Event like this

    Private Sub AdvancedDataGridView1_FilterStringChanged(sender As Object, e As EventArgs) Handles AdvancedDataGridView1.FilterStringChanged
    BindingSource1.Filter = AdvancedDataGridView1.FilterString : End SUB  

So now Added row in DT as like DT.rows.add() like this
so this ROW i Filled it By sum Of columns
ok.. Now look at the Image and see DGV NOW
THIS IS AdvancedDataGriddView NOW

So As You see there is Filter Icon up Wheni use it And filter data Like excel in MS its work fine
But the last row ( TOTAL ROW ) become Not exist after Filtering
I am sorry for my bad English and description


THIS IS WHAT I Have Tried


    Private Sub AdvancedDataGridView1_FilterStringChanged(sender As Object, e As EventArgs) Handles AdvancedDataGridView1.FilterStringChanged

    Dim A, B As String
    A = CStr(AdvancedDataGridView1.FilterString)
    B = CStr("Convert([ItemName],System.String) IN ('total')")
    BindingSource1.Filter = A Or B

Look Bro (A) Work Alone Fine Like (BindingSource1.Filter = A)
And (B) Work Alone Fine Like (BindingSource1.Filter = B)
But When I say (A Or B) together like this
this error Happened
Additional information: Conversion from string "(Convert([ItemAmount],System.Str" to type 'Long' is not valid.



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation