Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find/Search feature.

Status
Not open for further replies.

jk731

Technical User
Mar 17, 2001
2
GB

I'm trying to add a feature to a messaging system so that it will highlight all occurrences of a particular username, similar to the MSDN Library help where after searching for the keyword, all occurrences of the keyword will be highlighted. however, the object that the messaging system uses is a data grid, and I'm not able to change the background of particular words (to highlight). you can only change the background of an entire cell in the grid. any advice on how to do this would be greatly appreciated. or any insight as to how Microsoft does this simple feature would also help. thanks!
 
I'm not sure, but i think they use a rich text box, search the string, then change BGColor from that position through LEN of word, then switch back.
 
Thanks Tim!
i'm new to VB and just used a rich textbox for the first time. however, while i was able to change the color of the text at specified locations by using the "SelColor" property, i could not highlight parts of the text for the following 2 reasons.

1.There is no BGColor property. only BackColor property, which changes the background color of the entire rich textbox.

2.I can use SelStart and SelLength, but that only selects one instance of the text i'm searching for. i cannot use this to select multiple instances.

Am i missing something? i will keep trying, but if somebody knows, please shed some light. thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top