textbox questions

borris83

Member
Joined
Apr 30, 2009
Messages
23
Programming Experience
Beginner
1. I have a multiline texbox and want to know if there is a way to search for a text in the textbox... The user should be able to input a search string and click a button to search all the entries of the string in it, just like ctrl+f

2. Is there anyway to make the textbox 'read only'? The textbox is populated by application itself, with some logs.. The only reason I chose textbox was because, I can't select an item and copy it from label..

Also, can a textbox include formatting, such as making some text bold, underlined etc?..
 
Last edited by a moderator:
  1. You have to use the Text value, ie String, and its IndexOf method to search. For subsequent searches use the IndexOf method where you specify startIndex. To display matches you can use the Select method (and set HideSelection to False).
  2. TextBox Class (System.Windows.Forms) check out the properties (hint: see if it has a ReadOnly property)
  3. RichTextBox control exist for such purposes.
The only reason I chose textbox was because, I can't select an item and copy it from label..
From the sound of it perhaps a Listbox would be more suitable for listing items and have user select them.
 
Back
Top