Go Back  Xtreme Visual Basic Talk > Visual Basic .NET (2002/2003/2005/2008, including Express editions) > .NET General > Possible


Reply
 
Thread Tools Display Modes
  #1  
Old 10-26-2006, 04:42 AM
bacanze bacanze is offline
Newcomer
 
Join Date: Oct 2006
Posts: 4
Default Possible


Hi Everone

Right heres my idea:


Bascially I want to build a small app, which replaces ceratin words in artices, on the interface there will be two rtbs and a generate button, what I want to be able to do is something like this


I paste the article in one of the rtb and for example if the word 'is' appears in the article, it should be replaced with 'be'. For the programming side of it, im wondering if i could use if statements

e.g. if is appear, then
replace 'if' with 'be

if anyone knows code that would do this, please post it, It would be appriciated
Reply With Quote
  #2  
Old 10-26-2006, 07:09 AM
reboot's Avatar
reboot reboot is offline
Keeper of foo

Retired Moderator
* Guru *
 
Join Date: Nov 2001
Location: Graceland
Posts: 15,612
Default

Look up Replace$()
__________________
~ Quod non mortiferum, fortiorem me facit ~

Avatar by lebb
Reply With Quote
  #3  
Old 10-26-2006, 08:33 AM
torpkevuk's Avatar
torpkevuk torpkevuk is offline
Contributor
 
Join Date: Oct 2003
Location: Nebraska, USA
Posts: 640
Default

something like this
Code:
RichTextBox1.Text = Replace$(RichTextBox1.Text, "is", "be", 1, -1)

If you have a lot of words you need to change, you could get some kind of loop happening and use variables like

Code:
RichTextBox1.Text = Replace$(RichTextBox1.Text, strWord_to_replace, strReplacement_word, 1, -1)
Reply With Quote
  #4  
Old 10-27-2006, 01:33 PM
bacanze bacanze is offline
Newcomer
 
Join Date: Oct 2006
Posts: 4
Default

Thanks for info, works perfectly, however there is a little problem

say I have have set the word 'be' to be replaced with, 'let'

So if an article has words such as because or began in, it still replaces the 'be' bit so its looks like 'letcause' or 'letgan'


any ideas how to fix it?
Reply With Quote
  #5  
Old 10-27-2006, 01:37 PM
torpkevuk's Avatar
torpkevuk torpkevuk is offline
Contributor
 
Join Date: Oct 2003
Location: Nebraska, USA
Posts: 640
Default

replace on " be "
assuming there'll be a space in between the words seems the simplest method
course, you'll be knackered if there's a comma or period
Reply With Quote
  #6  
Old 10-27-2006, 01:59 PM
bacanze bacanze is offline
Newcomer
 
Join Date: Oct 2006
Posts: 4
Default

yeah good, idea, anyway ill just proof read afterwards to correct little mistakes, thanks
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->