Click here to Skip to main content
15,880,854 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hello everyone i have a datagridview control and it's contain multiple data.and i want to search textbox.text data is available or not available in datagridview (only a specific column) control ..if data is available then those cellbackcolor get chenged.in windows application...

Thanks in advance
Posted
Updated 5-Dec-12 1:35am
v2

Maybe it should work :
C#
int intcount = 0;
foreach (DataGridViewRow Row in DataGridView1.Rows) 
   {
     if (DataGridView1.Rows(intcount).Cells(0).Value == "StringSearch") {
        //Do Something
        intcount += 1;
    }
}
 
Share this answer
 
Comments
Shambhoo kumar 5-Dec-12 7:45am    
thanks sir...but i also want to chenge backcolor of those cell and focus also.
[no name] 5-Dec-12 7:47am    
I've commented //do sometghing....
I solve my self.....

C#
int intcount = 0;
foreach (DataGridViewRow Row in DataGridView1.Rows)
   {
     if (DataGridView1.Rows(intcount).Cells(0).Value == "StringSearch") {
        dataGridView1.Rows[intcount].Cells[0].Style.BackColor=Color.White;
        intcount += 1;
    }
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900