How can i search in a .txt file wod by word...

I will have a textbox(and a search button) and I need to search for the word entered in the textbox....


and display all the result in the listbox


Sorry if this exists somewhere else....
just post me the link because i couldnt find...

You can use these 2 methods - File.ReadAllText Method to read the file and String.Contains Method to search for the required string in the text from the file. You can then add the results to a listbox. Both these methods are mentioned in MSDN.

ok thnx...

i will check it and if i have any problems i will tell you :D

anyway thank you for replying

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.