目前,我的应用程序使用表达式上的 RowFilter 属性在 DataView 中搜索用户定义的字符串。目前我的代码看起来像这样:
Public Class MyClass
Private custView As DataView
Private Sub form_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
dsDataSet = <"DataAccessLayer call to SQL Stored Procedure">
custView = New DataView(dsDataSet.Tables(0))
custView.Sort = "Column Name"
Me.C1FlexGrid1.DataSource = custView
End Sub
Private Sub txtSearch_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSearch.TextChanged
Dim searchText As String = txtSearch.Text
Dim expression As String = "Column Name LIKE '" + searchText + "%'"
custView.RowFilter = expression
Me.C1FlexGrid1.DataSource = custView
End Sub
End Class
我的目标是修改它的行为,而不是过滤掉不符合搜索结果的行,而是保留所有行,但在用户在搜索框中键入时跳转到部分匹配的第一个实例。如果 DataView.Find() 支持通配符我会设置,但不幸的是它没有。