Hi I couldn't understand your reaction to that code. I mean if I need to find or replace don't I need a box to do like microsoft word have or I don't think I understand how does it work, since I am somehow new to C#.
i don't think exposing your form controls outsideof the form is a good thing, and you cant do it the way you did you can use constractors to do this, to add a constractor to your form that take a string and you write the find part in the search form you will instantiate the searchform like this
Find/Replace
Knvb1123
Can we select all the occurance of search_string in RichTextBox.
Is there any method or way to do that
WyattA
hi,
to find and replace in richtextbox you use the text property
to repalce you do something like this
rt.Text.Replace(
"oldvalue","newvalue");to find you may use something like this
string value = "something"; int start = rt.Text.IndexOf(value );rt.Select(start, value.Length);
hope this helps
JoeCoder
Hi I couldn't understand your reaction to that code. I mean if I need to find or replace don't I need a box to do like microsoft word have or I don't think I understand how does it work, since I am somehow new to C#.
thanks jbattat
Tsuru
If i want all the occurance of that text to be replaced then wat i have to do.
RajKS
Hi Mr. Shakalama, I created a search form called searchForm and i am trying to use that as find and replace and serach, with this code :
private
void findToolStripMenuItem_Click(object sender, EventArgs e){
searchForm searchForm = new searchForm();richTextBoxPrintCtrl1.Find(searchForm.Show);
searchForm.Show();
}
I am getting an error:
Error 1 The best overloaded method match for 'System.Windows.Forms.RichTextBox.Find(string)' has some invalid arguments .
Can you help
Thanks jbattat
DTSlurve
the code will replace all the occurance of the text
hope this helps
Al Dynarski
hi,
i don't think exposing your form controls outsideof the form is a good thing, and you cant do it the way you did you can use constractors to do this, to add a constractor to your form that take a string and you write the find part in the search form you will instantiate the searchform like this
SearchForm sf = new SearchForm("text to find");
hope this helps
computer_guy