搜索数据有界DGV上的行

时间:2014-03-29 02:11:51

标签: vb.net ms-access datagridview

我试过了:

If e.KeyCode = 13 Then
        Me.PigletsBindingSource.Filter = "EN like " & txtSearch.Text.ToString() & " %"
    End If

虽然它给我一个错误Missing operand before 'Mod' operator
怎么了?
我正在研究一个有界DGV的搜索引擎,因为只有通过向下滚动才能找到太多的数据。感谢

2 个答案:

答案 0 :(得分:1)

from other post in SO

Dim dv As New DataView
        dv.Table = MrlivestockDataSet.Tables("piglets")
        dv.RowFilter = "EN = '" & txtSearch.Text & "' "
        dgvReports.DataSource = dv

答案 1 :(得分:1)

尝试这样:

Dim bs as  BindingSource = new BindingSource()
bs.DataSource = dataGridView1.DataSource
bs.Filter = "EN = '" & txtSearch.Text & "%'"
dataGridView1.DataSource = bs