Find box to search for string in richtextbox in winforms application

I wrote a winform application where I have a form with a richtextbox control filled with a string. I need to find a specific string pattern from a string in a richtextbox control when the user presses ctr + F just like we find a specific string pattern in notepad ++. Do I need to create the Search window myself, or is there any default Search Window control I can use?

Any help is greatly appreciated.

+3


source to share


1 answer


You need to create a window where you will find a specific character / word or sentence. Windows Form Control does not provide any user interface tools to find your string. It also depends on where you want to find the string. you should have an editor like Textbox, RichTextbox or any control that contains string values ​​like DataGridView, WebBrowser Control, ListView, etc., but each control can have its own method to find a specific string. for example, if you want to find a string in the RichTextBox, then you have to call the method from that particular control ( richTextBox1.Find(...)

). You cannot find the string from all controls globally.



If you want to implement a feature in a specific control like TextEditor

(Word Pad), then there is an example on the Code Project site that you can link to. Search RichTextBox Control

0


source







All Articles