Replace Code
Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
8 posts
Page 1 of 1
Hello,
I need to know how to replace all occurrences of text that the user specified.
Example:
I click replace, window pops up. It says Find What and Replace With. I type Jim in Find and Bob in replace. I have Jim in 5 different places in my text. Different lines maybe, who knows. I click replace, and it changes every Jim in the RichTextBox to Bob. And I need the code for the Tabbed version too.
Early thanks to any helpers!
P.S. You will be put in my credits box if wanted.
~GoodGuy17
I need to know how to replace all occurrences of text that the user specified.
Example:
I click replace, window pops up. It says Find What and Replace With. I type Jim in Find and Bob in replace. I have Jim in 5 different places in my text. Different lines maybe, who knows. I click replace, and it changes every Jim in the RichTextBox to Bob. And I need the code for the Tabbed version too.
Early thanks to any helpers!
P.S. You will be put in my credits box if wanted.
~GoodGuy17

Try:
Code: Select all
RichTextBox1.Rtf = RichTextBox1.Rtf.Replace("old", "new")
or you can just have
Code: Select all
RichTextBox1.Rtf.Replace("Jim", "Bob")
We shall let the revolution begin.. the revolution for freedom, freedom against censorship. We shall fight in the fields and in the streets, we shall fight in the hills; we shall never surrender
i think livengood made a tutorial for this
Nailing my feet to the floor is easier than using my own muscles to balance, but you don't see me doing that 

codeXvideos wrote:or you can just haveCode: Select allRichTextBox1.Rtf.Replace("Jim", "Bob")
Incorrect i tried that before and it diddnt work.
would text work instead of rtf
Nailing my feet to the floor is easier than using my own muscles to balance, but you don't see me doing that 

oh i see
Nailing my feet to the floor is easier than using my own muscles to balance, but you don't see me doing that 

8 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023