Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# DataGridView WinForm
Hello,
 
I have one textbox. In which i am enter some text.
Now i want to search that text in the Datagridview.
I am also able to search that and i am going to highlight that cell.
But the problem is that i don`t want to highlight whole cell. I want to high light only search textbox text.
 
If i search 'abc' and if i found that in DataGridview then i am going to change the color of that cell. But i want to highlight only 'abc'. Not whole cell.
 
Please help me.
 
Thanks,
Viprat
Posted 13-Sep-12 1:25am
VIPR@T2.8K
Comments
Member 10391350 at 26-Nov-13 23:34pm
   
have you got the answer for this post.please post the code if you found the solution.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi,
 
Here is one workarround,
 
MSDN : TextRender.DrawText[^]
 
string.Format("{0}{1}{2}"str_previous,
TextRenderer.DrawText(e.Graphics,"SearchText", this.Font,new Point(10, 10), SystemColors.ControlText),
str_end);
 
You can update your cell Text with above code.
 
Hope it works for you,
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 434
1 Maciej Los 430
2 OriginalGriff 315
3 CHill60 240
4 Abhinav S 220
0 Sergey Alexandrovich Kryukov 10,102
1 OriginalGriff 9,495
2 Peter Leow 5,241
3 Kornfeld Eliyahu Peter 3,373
4 Maciej Los 3,076


Advertise | Privacy | Mobile
Web04 | 2.8.150327.1 | Last Updated 13 Sep 2012
Copyright © CodeProject, 1999-2015
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