c# - How do you find at what line a word is located in a textbox? -


i'm working on notepad has find option. when type in word it'll find , highlight it. got working i've reached wall can't seem pass method i'm using it. i'm splitting words in textbox ' ' , adding length of words untill find inputted search term can see found word was, can highlight it.

the problem have though, since i'm using split(' ') each word in textbox, whenever user adds new line split's return array "wordonfirstline\r\nwordonsecondline". counted 1 word. what's way can find word in textbox , see it's located can highlight it?

try splitting string as

string splitstring = stringtosplit.split(new char[] { ' ', '\n', '\r' }); 

it'll give empty string in between '\n' , '\r' characters, fix may closest you're doing.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -