M
moondaddy
Using vb.net 2.0 I'm trying to filter a dataview. From the code examples
I've seen, it looks correct, but its not having any effect. The datatable
has about 250 rows of data. after I apply the filter and set the dataview
as the datasource, I still see all of the rows. However, when I step
through it I can see the 'RowStateFilter' property says 'CurrentRows {22}'
which tells me the new filter returned 22 rows. If this is true, then why
doesn't the datagrid show only 22 rows?
Here's my code:
Dim sSort As String
Dim sFilter As String = "Co_ShortName Like '*" & _newText & "*' OR
Co_LongName Like '*" & _newText & "*'"
If Me.ugGoTo.DataSource Is Nothing Then Return
_newText = tx.Text
Static isDesc As Boolean
If isDesc = True Then
sSort = "Co_ShortName DESC"
Else
sSort = "Co_ShortName ASC"
End If
_tbCompanyNames.DefaultView.RowFilter = ""
_tbCompanyNames.DefaultView.RowFilter = sFilter
_tbCompanyNames.DefaultView.Sort = sSort
ugGoTo.DataSource = Nothing
ugGoTo.DataSource = _tbCompanyNames.DefaultView
Thanks.
I've seen, it looks correct, but its not having any effect. The datatable
has about 250 rows of data. after I apply the filter and set the dataview
as the datasource, I still see all of the rows. However, when I step
through it I can see the 'RowStateFilter' property says 'CurrentRows {22}'
which tells me the new filter returned 22 rows. If this is true, then why
doesn't the datagrid show only 22 rows?
Here's my code:
Dim sSort As String
Dim sFilter As String = "Co_ShortName Like '*" & _newText & "*' OR
Co_LongName Like '*" & _newText & "*'"
If Me.ugGoTo.DataSource Is Nothing Then Return
_newText = tx.Text
Static isDesc As Boolean
If isDesc = True Then
sSort = "Co_ShortName DESC"
Else
sSort = "Co_ShortName ASC"
End If
_tbCompanyNames.DefaultView.RowFilter = ""
_tbCompanyNames.DefaultView.RowFilter = sFilter
_tbCompanyNames.DefaultView.Sort = sSort
ugGoTo.DataSource = Nothing
ugGoTo.DataSource = _tbCompanyNames.DefaultView
Thanks.