I have a data grid view in one windows form named "GridViewForm". When the user search for the text from the search box from another window form named "FindForm", I want to highlight all the matching result in the data grid view. The search type can be exact or partial.
For eg.
If the user search for the text "stack", then the words "stack" from [Stack, stack-over, stacks, stack exchange] should be highlighted and first cell that match the query should be selected. When the user press next button then another cell that match the search query should be selected.
My code for finding the text is like follow for it search only the exact word.
Dim gridRow As Integer = 0
Dim gridColumn As Integer = 0
For Each Row As DataGridViewRow In AccountsDataGridView.Rows
For Each column As DataGridViewColumn In AccountsDataGridView.Columns
If TryCastString(AccountsDataGridView.Rows(gridRow).Cells(gridColumn).Value).ToLower = SearchTextBox.Text.ToLower Then
'AccountsDataGridView.Rows(intcount).Cells(0).Value = "0"
MsgBox("FOUND") 'Should be highlight insted of showing message and the cell should be select.
End If
gridColumn += 1
Next column
gridColumn = 0
gridRow += 1
Next Row
Is there any way to implement my concept? I am using vb.net windows form. Thanks in advance.