如何使用radiobutton在datagridview中搜索? [英] How to search in datagridview with radiobutton ?

查看:106
本文介绍了如何使用radiobutton在datagridview中搜索?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们!

我想在datagridview中搜索radiobutton1,radiobutton2,radiobutton3。

radiobutton1:显示所有项目

radiobutton2:显示所有应税项目

radiobutton3:显示所有非应税项目



如果选中radiobutton1我想在datagridview中显示:



| RECEIPT NO |可征收的物品|不可征税的项目|

| 1 | 20 | 00 |

| 2 | 15 | 20 |

| 3 | 00 | 16 |



如果选中radiobutton2我想在datagridview中显示:



| RECEIPT NO |可征收的物品|不可征税的项目|

| 1 | 20 | 00 |

| 2 | 15 | 20 |



如果选中radiobutton3我想在datagridview中显示:



| RECEIPT NO |可征收的物品|不可征税的项目|

| 2 | 15 | 20 |

| 3 | 00 | 16 |



请你能帮我这个吗?

非常感谢你们这样做吧。



我尝试了什么:



我试图在互联网上找到。

我没有找到任何关于这个,但试图用文本框搜索。使用文本框我无法搜索是否显示带有taxable_items的收据< 1但只有

 BindingSource17.Filter =(TAXABLE_ITEMS LIKE'& TextBox21.Text&')

解决方案

假设你的列是数字,而不是字符串:

 如果 RadioButton2.Checked 那么 
BindingSource17.Filter = TAXABLE_ITEMS> 0
ElseIf RadioButton3.Checked 然后
BindingSource17.Filter = NON_TAXABLE_ITEMS> 0
其他
BindingSource17.Filter =
结束 如果



现在帮自己一个忙,开始给你控制有意义的名称,而不是接受设计者建议的默认值。您可能还记得 BindingSource17 现在是 ,但是当您在六个月后回到代码时,您将不会有任何线索!


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 & "')"

解决方案

Assuming your columns are numbers, and not strings:

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!


这篇关于如何使用radiobutton在datagridview中搜索?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆