Mar 4, 2005 #1 Horowitz Programmer Joined Jan 29, 2005 Messages 30 Location GR Well, I write: textbox1.text.replace("hi","hello") but nothing happens. I suppose that it will work like below: Textbox1.text: After replacement: hi hello HI hello 'not case sensitive high hellogh Any "support" for this easy ...thing? Tnx
Well, I write: textbox1.text.replace("hi","hello") but nothing happens. I suppose that it will work like below: Textbox1.text: After replacement: hi hello HI hello 'not case sensitive high hellogh Any "support" for this easy ...thing? Tnx
Mar 4, 2005 #2 JohnYingling Programmer Joined Mar 24, 2001 Messages 3,742 Location US textbox1.text is a function of tghe TextBox Class that returns a string. Replace is a Function of the String class. Try textbox1.text = textbox1.text.replace("hi","hello") http://www.VBCompare.com Compare Code Upvote 0 Downvote
textbox1.text is a function of tghe TextBox Class that returns a string. Replace is a Function of the String class. Try textbox1.text = textbox1.text.replace("hi","hello") http://www.VBCompare.com Compare Code
Mar 4, 2005 #3 dalchri Programmer Joined Apr 19, 2002 Messages 608 Location US The replace method does not act on the string it is invoked on but rather returns a new string base on the string it is invoked on as input. So you need to do this: textbox1.text = textbox1.text.replace("hi","hello") Upvote 0 Downvote
The replace method does not act on the string it is invoked on but rather returns a new string base on the string it is invoked on as input. So you need to do this: textbox1.text = textbox1.text.replace("hi","hello")
Mar 4, 2005 #4 vladk Programmer Joined May 1, 2001 Messages 991 Location US Dim RegX Dim SearchPattern, ReplacedText Set RegX = NEW RegExp SearchPattern = "hi" RegX.Pattern = SearchPattern RegX.Global = True textbox1.text = RegX.Replace(textbox1.text, "hello") Upvote 0 Downvote
Dim RegX Dim SearchPattern, ReplacedText Set RegX = NEW RegExp SearchPattern = "hi" RegX.Pattern = SearchPattern RegX.Global = True textbox1.text = RegX.Replace(textbox1.text, "hello")