esps
asked on
Datagridview Search
I am using a datagridview that I populate from the local machine's Outlook contacts. I am not currently using a dataset or table but populating the data directly from Outlook. This is all working fine. The datagridview contains a checkbox that I'll use to loop and perform some action with all the selected rows. My challenge is to add some intelligent search options to type a value into a text box and search the grid. If I do not get the right 'John' I would like to continue the search and move to the next 'John'
I got the first part working to some extend but need some help.
Current search Code snippet included under code
I got the first part working to some extend but need some help.
Current search Code snippet included under code
Dim x As Integer = 0
While x < DataGridView1.Rows.Count
Dim y As Integer = 0
While y < DataGridView1.Rows(x).Cells.Count
Dim c As DataGridViewCell = DataGridView1.Rows(x).Cells(y)
If CType(c.Value, String) Is Nothing Then
Else
If InStr(UCase(CType(c.Value, String)), UCase(TextBox2.Text)) Then
DataGridView1.Rows(x).Selected = True
DataGridView1.CurrentCell = DataGridView1.Rows(x).Cells(y)
End If
End If
System.Math.Min(System.Threading.Interlocked.Increment(y), y - 1)
End While
System.Math.Min(System.Threading.Interlocked.Increment(x), x - 1)
End While
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER