Help in remove text

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions 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.
6 posts Page 1 of 1
Contributors
User avatar
troop
Dedicated Member
Dedicated Member
Posts: 75
Joined: Sat Sep 28, 2013 11:57 am

Help in remove text
troop
hi

i have a small problem, i want to do something like this:

i have a textbox and i want to press a button and it removes for example all the "the's" in it, but i think it can be done by

textbox1.text = textbox1.text.replace("the,"") I THINK it looks like this if not tell me

also i want a second help (part 2)

I have a textbox2.text i want to remove ONLY the first the in it, like if it was
the car is the best
it will remove the first the and keep the all rest, so it be then "car is the best" hope u get me

plz help i know this is just 1 lines of code but i didnt find it anywhere
User avatar
comathi
Coding God
Coding God
Posts: 1242
Joined: Fri Mar 26, 2010 1:59 pm

Re: Help in remove text
comathi
Removing all instances of "the" in your TextBox is indeed as easy as:
Code: Select all
TextBox1.Text = TextBox1.Text.Replace("the", "")
Removing only the first instance isn't that much harder. You must use the TextBox.Text Substring:
Code: Select all
TextBox1.Text = TextBox1.Text.Substring(TextBox1.Text.IndexOf("the") + 3)
This will find the first occurence of "the" in your text, add 3 to the position and keep the rest of the text only. If you wish to remove "the" and the following space, do +4 instead of +3 cooll;
User avatar
troop
Dedicated Member
Dedicated Member
Posts: 75
Joined: Sat Sep 28, 2013 11:57 am

Re: Help in remove text
troop
man who are u!!!!!!!


WHY ARE U THE BEST PEPRSON ALIVE I LOVE U ( HO MO) xD jk

i will try it now
User avatar
troop
Dedicated Member
Dedicated Member
Posts: 75
Joined: Sat Sep 28, 2013 11:57 am

Re: Help in remove text
troop
works thanks!
Filip
Coding Guru
Coding Guru
Posts: 833
Joined: Wed Jan 05, 2011 3:59 pm

Re: Help in remove text
Filip
Hello troop,

Please try editing your posts instead of posting 2+ posts in a row.. Also use reputation system to say thanks to someone, not post it (We want to keep the community clean of short generic posts)
CodenStuff wrote:
Nope, it's just your sick and dirty mind. You sick twisted warped little pervo :D
User avatar
troop
Dedicated Member
Dedicated Member
Posts: 75
Joined: Sat Sep 28, 2013 11:57 am

Re: Help in remove text
troop
sorry cryer;
6 posts Page 1 of 1
Return to “Coding Help & Support”