Page 1 of 2
Replace Text in a TextBox HELP?!
Posted: Fri Mar 11, 2011 11:15 pm
by Napster1488
Hello Guys,
i never had problems with the textbox.text.replace function but this time anyway it wont work...
So my Problem is i have a Textbox,Button and WebBrowser , i navigate to youtube trough the text from my textbox and the textbox shows me later the actual url soo...
and i added this code to replace some lines from the url in the textbox
Code: Select alltextbox1.text.replace("http://www.youtube.com/watch?v="," ")
textbox1.text.replace("&feature=related"," ")
But anyway it wont work , it doesnt replace the text in it , someone can help ?!
Re: Replace Text in a TextBox HELP?!
Posted: Fri Mar 11, 2011 11:21 pm
by Agust1337
try:
Code: Select allTextbox1.text = textbox1.text.replace("http://www.youtube.com/watch?v="," ")
Re: Replace Text in a TextBox HELP?!
Posted: Fri Mar 11, 2011 11:26 pm
by Napster1488
Agust1337 wrote:try:
Code: Select allTextbox1.text = textbox1.text.replace("http://www.youtube.com/watch?v="," ")
doesnt work , after added this code in the textbox i got "about:blank"
Re: Replace Text in a TextBox HELP?!
Posted: Fri Mar 11, 2011 11:31 pm
by Agust1337
Napster1488 wrote:Agust1337 wrote:try:
Code: Select allTextbox1.text = textbox1.text.replace("http://www.youtube.com/watch?v="," ")
doesnt work , after added this code in the textbox i got "about:blank"
Add it as a code not in the textbox
Re: Replace Text in a TextBox HELP?!
Posted: Fri Mar 11, 2011 11:34 pm
by Napster1488
I added it as Code,to the WebBrowser DocumentCompleted Event.
Re: Replace Text in a TextBox HELP?!
Posted: Sat Mar 12, 2011 12:12 am
by Agust1337
try the Navigated event
Re: Replace Text in a TextBox HELP?!
Posted: Sat Mar 12, 2011 12:30 am
by Napster1488
Agust1337 wrote:try the Navigated event
Doesnt work too :(
Re: Replace Text in a TextBox HELP?!
Posted: Sat Mar 12, 2011 4:08 am
by Zulf
Code: Select allRichTextBox1.Text = TextBox1.Text
RichTextBox1.Text.Replace("find","replacewith")
TextBox1.Text = RichTextBox1.Text
Cheap. :P
Re: Replace Text in a TextBox HELP?!
Posted: Sat Mar 12, 2011 1:10 pm
by Napster1488
Zulf wrote:Code: Select allRichTextBox1.Text = TextBox1.Text
RichTextBox1.Text.Replace("find","replacewith")
TextBox1.Text = RichTextBox1.Text
Cheap. :P
Ill try it. Thanks!
Re: Replace Text in a TextBox HELP?!
Posted: Sat Mar 12, 2011 2:01 pm
by bisnes_niko
If I remember right, you MUST do it this way:
Code: Select allTextBox1.Text = TextBox1.text.Replace("original", "new")