Help??

vbnewbie2002
09-28-2002, 10:40 AM
Ok im a real newbie and i have a question but u will have 2 explain as best as possible k? Ok is there a way that i could enter works into a text file and then say save the file as e.g test.txt the when i open my program and type some words into a text box as i type the text box would wait for a work i entered and replace it with a differnt 1 e.g the text file could look like this hello - hi then when i type hello im my text file in my program it would change to hi but i want to do this with as many words as possible... Thanks Me!..

crabby
09-28-2002, 10:48 AM
if you know the words try replace or replace$

vbnewbie2002
09-28-2002, 10:50 AM
?? Im a newbie i dont quite understand.. P.s how would i get it 2 read from the .txt file aswel?? thanks....

crabby
09-28-2002, 11:05 AM
Text1.Text = Replace$(Text1.Text, "old word", "new word")

Iceplug
09-28-2002, 11:25 AM
To read from the text file, try this:

Open "yourtextfile" For Input As #1
Line Input #1, ReadStr
Close #1

you will probably need to read each line into an array.

vbnewbie2002
09-28-2002, 12:00 PM
????

vbnewbie2002
09-28-2002, 12:03 PM
morsnowski would the text1.replace thing work? I didnt think it would case it would be readin off a textfile????

JDT
09-28-2002, 12:04 PM
Try taking these examples and adding them to your code or start a new project so you can test them and see how they work. This is just about the only way to learn and understand VB.

crabby
09-28-2002, 12:07 PM
sorry sometimes i'm a little confused ok so read you text file into an array and check in then. and just play around thats the funniest way to learn

vbnewbie2002
09-28-2002, 12:07 PM
OK then

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum