我有dgv
当我在组合框中选择特定值时,需要过滤它。如果我选择星期一,它应该通过"排序"
过滤它我尝试使用此代码
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
Me.TableDaysBindingSource.Filter = "Sort = '" & ComboBox1.SelectedValue & "'"
End Sub
结果是空表。我做错了什么?
答案 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