searching datagrid

rjhe22

Well-known member
Joined
May 22, 2008
Messages
88
Programming Experience
Beginner
this is the code i used to search a datagrid

Private Sub txtSearch_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSearch.TextChanged

Dim strFilter As String = ""


For Each col As DataColumn In Me._main.Columns
If Me.grdTask.Columns(col.ColumnName).Visible = True Or Not String.IsNullOrEmpty(col.Expression) Then

Dim strClause As String = "CONVERT(" & col.ColumnName & ",'System.String') LIKE '*" & Me.txtSearch.Text & "*'"
If strFilter = "" Then
strFilter &= strClause
Else
strFilter &= " OR " & strClause
End If

End If

Next

Me.bndTask.Filter = strFilter



End Sub



but i need this part of the code as well to get the search working correctly
Me._datset.Relations.Add(TableName & "_" & Me._main.TableName, _
tbl.Columns(IDColumn), Me._main.Columns(IDColumn))

Dim datCol As New DataColumn(DisplayColumn)
datCol.DataType = tbl.Columns(DisplayColumn).DataType
datCol.Expression = "Parent(" & TableName & "_" & Me._main.TableName & ")." & DisplayColumn
Me._main.Columns.Add(datCol)
Me.grdMain.Columns(DisplayColumn).Visible = False


any one have anyidea what the best way to do this is
 
it might no be able to solve it this time but that will be very handy to no for another time. i will defo be using that again just not now.
and i do appreciate the help
but i have my code just need to get them both working together
Argument not specified for parameter 'DisplayColumn' of 'Public Sub Loadsearch(IDColumn As String, TableName As String, DisplayColumn As String)'.

u dont no how to overcome this or are ya to piss of with me to help
 
I never saw a method called LoadSearch before, but the compiler is telling you tha tyou havent specified a parameter for the relevant argument.

Example:

LoadSearch(1,2)

LoadSearch takes 3 parameters, i only supplied 2. Its a basic error, nothing more
 

Latest posts

Back
Top