Hello again,
I'm using RadGridView for WinForms Q2. I want to iterate through all cells and highlight text which I am searching for.
I could live with changing the background of the found cell.
The following approch produces errors.
I would be grateful for some help. Cheers Roberto
I'm using RadGridView for WinForms Q2. I want to iterate through all cells and highlight text which I am searching for.
I could live with changing the background of the found cell.
The following approch produces errors.
I would be grateful for some help. Cheers Roberto
Private Sub SearchPhraseInGrid(ByVal searchphrase As String, Optional ByVal colname1 As String = "", Optional ByVal colname2 As String = "")
Dim gv As RadGridView = Me.gvMessages
Dim col As GridViewDataColumn
Dim row As GridViewRowInfo
Dim i As Integer
For Each col In gv.Columns
For Each row In gv.Rows
If (row.Cellscol.FieldName).Value.ToString).Contains(searchphrase) = True Then
i = Me.gvMessages.Rows.IndexOf(Me.gvMessages.CurrentRow)
Me.gvMessages.CurrentRow = Me.gvMessages.Rows(i)
Me.gvMessages.MasterGridViewTemplate.CurrentColumn = Me.gvMessages.Columns(col.Index)
Me.gvMessages.GridElement.CurrentCell.BackColor = Color.Azure
End If
Next
Next
End Sub