【问题标题】:Vb.net 2010, how to use two filters at the same timevb.net 2010,如何同时使用两个过滤器
【发布时间】:2026-02-06 13:05:02
【问题描述】:

我想一次使用两列过滤 Visual Basic 中的数据网格视图。例如:我想过滤主题列和姓氏列,

我目前正在使用此代码: me.studentbindingsource.filter = "Subject_code like '%" & ComboBox1.Text & "%'"

但它一次只过滤一个。

【问题讨论】:

  • filter=String.Format("Subject_code like '{0}**' and Last_name like '{1}*'",Combobox1. text,strLastname) 它过滤两列,我如何过滤三列或更多,我应该改变什么?

标签: vb.net datagridview filter


【解决方案1】:

使用 String.Format,

me.studentbindingsource.filter = String.Format("Subject_code like '{0}**' and Last_name like '{1}*'",Combobox1.text,strLastname)

【讨论】:

  • 非常感谢,它确实有效。 :D 顺便问一下,'{0}** 而另一个是 '{1}* 的目的是什么