【发布时间】:2023-03-13 15:44:01
【问题描述】:
我正在尝试根据 2 个组合框过滤绑定源。我有一个组合框过滤器就好了。第二个让我难过,因为它使用第一个组合框,然后第二个基于 switch 语句:
private void comboBox2_SelectedIndexChanged(object sender,
System.EventArgs e)
{
string sItem;
sItem = comboBox2.SelectedItem.ToString();
switch (sItem)
{
case "Banks":
propertyInformationBindingSource.Filter = ("ClientKey ='" + comboBox1.SelectedValue + "'" And "Search = -1");
break;
case "Exam":
propertyInformationBindingSource.Filter = ("ClientKey ='" + comboBox1.SelectedValue + "'") And ("Exam = -1");
break;
case "Search Finished":
propertyInformationBindingSource.Filter = ("ClientKey ='" + comboBox1.SelectedValue + "'") And ("Finished = -1;
break;
case "All":
propertyInformationBindingSource.Filter = "ClientKey ='" + comboBox1.SelectedValue + "'";
break;
}
}
我对它声称错误的 AND 之后的值有疑问。任何帮助都会很棒。
谢谢
【问题讨论】:
标签: c# filter bindingsource