Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
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

Hi,

Here is one workarround,

MSDN : TextRender.DrawText[^]

C#
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,
 
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