如何从多个文本文档中读取所有文本以检查单词VB.NET [英] How do I read all text from multiple text documents to check for a word VB.NET

查看:106
本文介绍了如何从多个文本文档中读取所有文本以检查单词VB.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我需要从多个文本文件中读取所有文本以查找某个单词以查看该单词是否在文件中(例如ImTheWord)所以它从7个txt docs读取所有文本,如果有一个ImTheWord则显示messagebox说我们找到了。例如,也许这是一个类似的东西(这是一个文本doc)

My.Computer.FileSystem.ReadAllText(Textdoc1)或somthing



我尝试过:



So i need to read all text from multiple text files for a certain word to see if the word is in the file (e.g. ImTheWord) So it reads all text from say 7 txt docs and if one has ImTheWord in then show messagebox saying we found it. For example maybe somthing simular to this(this is for one text doc)
My.Computer.FileSystem.ReadAllText(Textdoc1) or somthing

What I have tried:

My.Computer.FileSystem.ReadAllText(TextDocPath,TextDocPath,TextDocPath,TextDocPath,)

推荐答案

你经历一个文件名循环,然后在每个文件名上做一个ReadAllText,一次一个。检查返回的文本中是否存在您的工作,然后如果找到该单词,则转到下一个文件或退出循环。
You go through a loop of your filenames and then do a ReadAllText on each, one at a time. Check to see if your work exists in the returned text, then move on to the next file or bail out of the loop if you find the word.


这篇关于如何从多个文本文档中读取所有文本以检查单词VB.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆