i used this code to search in datagridview to find and select row ! (no filter)
butt, when datagrid have Repetitive value in row's ---> dont get next row !
How do I put a button to the next row with every click to Btn_find ?
(Find similar Excel)
butt, when datagrid have Repetitive value in row's ---> dont get next row !
How do I put a button to the next row with every click to Btn_find ?
(Find similar Excel)
private void button1_Click(object sender, EventArgs e)
{
button1.Text = "Find Next";
{
foreach (DataGridViewRow row in dataGridView1.Rows)
{
if (row.Cells["ProductId"].Value == null)
{
continue;
}
if (row.Cells["ProductId"].Value.ToString().Trim() == textBox1.Text)
{
dataGridView1.CurrentCell = row.Cells["ProductId"];
dataGridView1.FirstDisplayedScrollingRowIndex = dataGridView1.Rows[row.Index].Index;
return;
}
}
}
}


ramya bharathRank #3,780 · 391 reputationPosted May 6, 2015, 9:52 AM EDT
Dipankar BiswasRank #992 · 2K reputationPosted May 6, 2015, 7:21 PM EDT
see this link to help..http://stackoverflow.com/questions/19444955/getting-next-row-of-table-of-access-database-every-time-on-clicking-a-button
ramya bharathRank #3,780 · 391 reputationPosted May 7, 2015, 2:22 AM EDT
So similar way you can store that row index and in the find next skip that first row alone and make the next search as the first.
For example first time you search that row 3 matches and display as first row next time the first row will obviously match skip that and find the next
Instead you can follow this approach .
1. Process each and every row by row index
2. if the keyword matches highlight the row
3. On find next get the highlightedvrow and process from that row index
ghasem dehRank #8,160 · 227 reputationPosted May 6, 2015, 12:18 PM EDT
I do not want to filter ...
But like Excel search and find the next row, the amount is equal
ghasem dehRank #8,160 · 227 reputationPosted May 6, 2015, 11:43 PM EDT
this my form : PIC