[Richtextbox].Rtf.Replace();

  • Thread starter Thread starter Michael J Robinson
  • Start date Start date
M

Michael J Robinson

Load richtextbox with a .rtf document. Want to use the
Rtf.Replace method to replace text, but nothing happens.
If anyone has suggestions it'll be greatly appreciated
Thanks - Michael
 
Michael,

The reason this doesn't work is that the Replace method on the string
class will return a string where the Replace occurs. It does not modify the
original string. So, in order to perform the replace, you would have to do
this:

// Assume the textbox is named mobjRtf.
mobjRtf.Rtf = mobjRtf.Rtf.Replace("hello", "bye");

Hope this helps.
 
Back
Top