Valhalla Legends Forums Archive | Visual Basic Programming | Help....

AuthorMessageTime
OuTLawZGoSu
How can i make it so, when you press a button, it opens a text file(txt), searches for specific text, then matches it with everything in text1. if it all matches, show a msgbox.

thx.
December 18, 2003, 7:33 PM
Null
pscode.com
December 18, 2003, 11:24 PM
Grok
[quote author=OuTLawZGoSu link=board=31;threadid=4336;start=0#msg36219 date=1071776039]
How can i make it so, when you press a button, it opens a text file(txt), searches for specific text, then matches it with everything in text1. if it all matches, show a msgbox.

thx.
[/quote]

Easy.

1. Make a button.
2. Add code to the button to open a text file and read the contents.
3. While reading the contents, search for the specific text.
4. I dont understand the "matches it with everything in text1" part.
5. If it all matches, show a msgbox.

Hope this helps.
December 18, 2003, 11:27 PM
Null
lol.
December 18, 2003, 11:37 PM
OuTLawZGoSu
[quote author=Grok link=board=31;threadid=4336;start=0#msg36267 date=1071790021]
Easy.

1. Make a button.
2. Add code to the button to open a text file and read the contents.
3. While reading the contents, search for the specific text.
4. I dont understand the "matches it with everything in text1" part.
5. If it all matches, show a msgbox.

Hope this helps.
[/quote]

I got everything exept for the search for the text code. I dont know how to search for the text in the text file.
And number 4, i meant, "If text1.text = Searched text Then"

December 19, 2003, 12:26 AM
Null
i suggest looking into the LIKE operator?
December 19, 2003, 12:44 AM
Grok
[quote author=OuTLawZGoSu link=board=31;threadid=4336;start=0#msg36279 date=1071793591]
[quote author=Grok link=board=31;threadid=4336;start=0#msg36267 date=1071790021]
Easy.

1. Make a button.
2. Add code to the button to open a text file and read the contents.
3. While reading the contents, search for the specific text.
4. I dont understand the "matches it with everything in text1" part.
5. If it all matches, show a msgbox.

Hope this helps.
[/quote]

I got everything exept for the search for the text code. I dont know how to search for the text in the text file.
And number 4, i meant, "If text1.text = Searched text Then"


[/quote]

InStr
InStrRev
StrComp
Like

Those are sufficient for most tasks.
December 19, 2003, 1:18 AM
Null
Sorry refer to my post below , bashed the keyboard and accidently posted and didnt realise =/ My bad
December 19, 2003, 2:40 AM
Null
Against better judgement im gonna post this up , maybe u can find a better example somewhere else

[code]
Dim Scompare as Long
Dim String1 as String
Dim String2 as String

Scompare = InStr(String1, String2, vbTextCompare)
IF Scompare = > 0 Then
dowhateverupleaserighthere
End if
[/code]

there u go knock yourself out
December 19, 2003, 2:44 AM

Search