Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have AdvancedDatagridview and it has filter Icon at the header like this
the next Code Work With me fine when i Open Filter and choose some of data
But when I Use Select ALL Chosen i get this error

Here is Code
VB
<pre>    Private Sub AdvancedDataGridView1_FilterStringChanged(sender As Object, e As EventArgs) Handles AdvancedDataGridView1.FilterStringChanged

        Dim A, B As String
        A = AdvancedDataGridView1.FilterString
        B = A & " Or ItemName = 'total'"
        BindingSource1.Filter = B


and this is ERROR I GOT

Additional information: Syntax error: Missing operand before 'Or' operator.


What I have tried:

Please tell me what I have to DO
Posted
Updated 18-Jul-23 22:45pm

This sis a 3rd-party control. You need to communicate with the author of the control. I did a quick search and here is where you can ask questions: Issues · davidegironi/advanceddatagridview · GitHub[^]
 
Share this answer
 
At a guess, the FilterString is empty. Try checking for that first:
VB.NET
Dim A As String = AdvancedDataGridView1.FilterString
Dim B As String = If(String.IsNullOrEmpty(A), "ItemName = 'total'", A & " Or ItemName = 'total'")
BindingSource1.Filter = B
 
Share this answer
 
Comments
Ahmed Saif 2022 20-Jul-23 15:05pm    
WOOOW BRO it's work But i Changed it look
Dim A As String = AdvancedDataGridView1.FilterString
Dim B As String = If(String.IsNullOrEmpty(A), A, A & " Or ItemName = 'total'")
BindingSource1.Filter = B
THaaaank You Very Much
You are missing an apostrophe, your syntax requires apostrophes around the string values. If I am correct it should read -

Dim A, B As String
'Enclose the string from datagrid in apostrophe's - exploded view - " ' "...
        A = "'" & AdvancedDataGridView1.FilterString & "'"
        B = A & " Or ItemName = 'total'"
        BindingSource1.Filter = B
 
Share this answer
 
Comments
Ahmed Saif 2022 20-Jul-23 15:08pm    
Thank you bro

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900