Link to home
Start Free TrialLog in
Avatar of BI5HOP
BI5HOP

asked on

scanning RTB for matches in VB6

I am trying to build an application that will read text from a .txt file, and scan for the text in a richtextbox, When a word from my .txt  file is found it will then change its color to red in the RTB
I am able to search for one word at a time from a text box that i added to the form and it will color the text red also.
i added another command button for the option of searching from my textfile
I dont seem to be able to get the strings into an array correctly or something mabey one of you will know what i need to do
my text file i am reading from is named basewords
and i filled iit with the words like this
word|word|word|word|word|


Below is what i have so far

Dim fs, f
    Dim sFileContents As String
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.OpenTextFile(app.path + \basewords, ForReading, 0)
    sFileContents = f.ReadLine
    f.Close
    Set f = Nothing
    Set fs = Nothing
Avatar of rajaloysious
rajaloysious

First thing
 Set f = fs.OpenTextFile(app.path + \basewords, ForReading, 0)
should be
 Set f = fs.OpenTextFile(app.path +" \basewords", ForReading, 0)
Let me know if this doesnt work still - i ll have a look.

Good luck
ASKER CERTIFIED SOLUTION
Avatar of harris_c
harris_c
Flag of Philippines image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BI5HOP

ASKER

Outstanding harris_c
i had a guy helping me last night and we got it but it had faults like when we added to the basefile it wold always find the text and it wouldnt run smooth through the scan it went back and forth your code is awesome thank you :)
it scans smooth through huge files also :)
great job
Avatar of BI5HOP

ASKER

one lst thin i guess i forgot to say i have two check boxes in the application
they are
check1(0) this one is for exact text but not case
check1(1)  this one is for exact case and text
obviously  they dont work on this last button where does the code go in the above click event ?