Click here to Skip to main content
12,953,652 members (51,545 online)
Rate this:
 
Please Sign up or sign in to 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 5-Dec-12 1:31am
Updated 5-Dec-12 1:35am
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Maybe it should work :
int intcount = 0;
foreach (DataGridViewRow Row in DataGridView1.Rows) 
   {
     if (DataGridView1.Rows(intcount).Cells(0).Value == "StringSearch") {
        //Do Something
        intcount += 1;
    }
}
  Permalink  
Comments
Shambhoo kumar 5-Dec-12 7:45am
   
thanks sir...but i also want to chenge backcolor of those cell and focus also.
Krunal Rohit 5-Dec-12 7:47am
   
I've commented //do sometghing....
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

I solve my self.....

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;
    }
}
  Permalink  

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

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,429
CHill60 3,490
Maciej Los 3,103
ppolymorphe 2,020
Jochen Arndt 1,975


Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 29 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100