带有组合框的DataBindingSource过滤器

时间:2015-03-25 08:18:29

标签: vb.net datagridview combobox

我有dgv enter image description here

当我在组合框中选择特定值时,需要过滤它。如果我选择星期一,它应该通过"排序"

过滤它

我尝试使用此代码

   Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
    Me.TableDaysBindingSource.Filter = "Sort = '" & ComboBox1.SelectedValue & "'"
End Sub

结果是空表。我做错了什么?

1 个答案:

答案 0 :(得分:0)

.Text而不是.SelectedItem

 Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
    Me.TableDaysBindingSource.Filter = "Sort = '" & ComboBox1.Text& "'"
End Sub