Click here to Skip to main content
15,886,045 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi friends!
I want to search in datagridview with radiobutton1, radiobutton2, radiobutton3.
radiobutton1 : show all items
radiobutton2: show all taxable items
radiobutton3: show all non-taxable items

If checked radiobutton1 I want to show in datagridview:

| RECEIPT NO | TAXABLE ITEMS | NON-TAXABLE ITEMS |
| 1 | 20 | 00 |
| 2 | 15 | 20 |
| 3 | 00 | 16 |

If checked radiobutton2 I want to show in datagridview:

| RECEIPT NO | TAXABLE ITEMS | NON-TAXABLE ITEMS |
| 1 | 20 | 00 |
| 2 | 15 | 20 |

If checked radiobutton3 I want to show in datagridview:

| RECEIPT NO | TAXABLE ITEMS | NON-TAXABLE ITEMS |
| 2 | 15 | 20 |
| 3 | 00 | 16 |

Please can you help me for this ?
THANK YOU VERY MUCH :)

What I have tried:

I tried to find in internet.
I did not find anything about this but tried to search with textbox. With textbox I can not to search if not to appear receipts with taxable_items < 1 but only
BindingSource17.Filter = "(TAXABLE_ITEMS LIKE '" & TextBox21.Text & "')"
Posted
Updated 26-Sep-17 7:59am

1 solution

Assuming your columns are numbers, and not strings:
VB.NET
If RadioButton2.Checked Then
    BindingSource17.Filter = "TAXABLE_ITEMS > 0"
ElseIf RadioButton3.Checked Then
    BindingSource17.Filter = "NON_TAXABLE_ITEMS > 0"
Else
    BindingSource17.Filter = ""
End If

Now do yourself a favour, and start giving your controls meaningful names, rather than accepting the defaults suggested by the designer. You might remember what BindingSource17 is now, but when you come back to your code in six months time, you won't have a clue!
 
Share this answer
 
Comments
ionMEMBER 27-Sep-17 8:30am    
Thank you very much !! You're the best :)

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