Click here to Skip to main content
12,630,386 members (28,930 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# DataGridView
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 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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.161205.3 | Last Updated 13 Sep 2012
Copyright © CodeProject, 1999-2016
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