提问人:Jitendra Kumar singh 提问时间:9/22/2022 最后编辑:JohnJitendra Kumar singh 更新时间:9/22/2022 访问量:34
在 vb.net DataGrideView 筛选器中,按 Combobox 筛选
in vb.net datagrideview filter by Combobox
问:
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim dt As DataTable
Dim dv As DataView
dt = DirectCast(DataGridView1.DataSource, DataTable)
dv = New DataView(dt, "[Game Name]='DERA'", "[Game Name] desc", DataViewRowState.CurrentRows)
DataGridView1.DataSource = dv
End Sub
这是我的代码正在工作,但是我需要combobox1过滤这个代码,就像下一个代码一样
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim dt As DataTable
Dim dv As DataView
dt = DirectCast(DataGridView1.DataSource, DataTable)
dv = New DataView(dt, "[Game Name]" = ComboBox2.SelectedItem, "[Game Name] desc", DataViewRowState.CurrentRows)
DataGridView1.DataSource = dv
End Sub
答: 暂无答案
评论
DataSource
DataTable
DefaultView.RowFilter
DataTable
BindingSource
Filter
BindingSource