i am working on an assignment to search a value in datagridview column if value matched with input textbox then datagrid cursor should move to the cell having that searched vallue and if column has more than one searched values then cursor should move to next cell having that particular searched value and so on .e.g
suppose that if we search for value AROUT which is in cell nomber 3,5 and 7 when user hit the serch button first time then data grid cursor should move to the 3rd cell and when user again click search button then datagrid cursor should move to the 5th cell and when user click search button third time then datagrid cursor should move to the 7th cell
i have tried many combination with FOR loop and IF condition
but with following code by default FOR loop starts from first row and goes till the 7th row but does not comes back to the first row,and when we click the search button after clicking the 6th row it does not find previous two values which are in 3rd and 5th row'
how can i loop back to the first row.
it is hard to explain for me but i hope that i am able to convey my point
my code is
Dim j As Integer
Dim i As Integer
j = DataGridView1.Rows.Count - 2
i = DataGridView1.CurrentRow.Index + 1
For i = i To j
If DataGridView1.Rows(i).Cells(3).Value.ToString.ToLower = TextBox4.Text.ToLower Then
DataGridView1.CurrentCell = DataGridView1.Rows(i).Cells(3)