在文本框中搜索文本文件,然后打开并编辑 [英] Search for a text file in textbox and open and edit
本文介绍了在文本框中搜索文本文件,然后打开并编辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在特定目录的文本框中搜索文本文件(例如:D:/ Logs /),然后以新的形式打开并编辑文本文件中的文本新文本中单独文本框上文本文件的每行文本。
我尝试了什么:
不知道该怎么做它不能得到任何想法需要帮助
解决方案
让我们分解你的问题 -
1.您需要搜索给定目录中的文件
Directory.GetFiles方法(字符串,字符串)(System.IO) [ ^ ]
如何:从Visual Basic中读取文本文件Microsoft Docs [ ^ ]
2.阅读文本文件
如何:从文本文件中读取(C#编程指南)| Microsoft Docs [ ^ ]
3. withSystem.IO.File .ReadAllLines
你可以获得行的数组,并填充文本框中的每一行(提示:使用代替
循环。: ))。
希望这会有所帮助。
KR
Search for a text file in textbox in a particular directory (ex : D:/Logs/) and open and edit the text's in the text file in a new form each line of text from text file on separate textbox in new form.
What I have tried:
Dont know how to do it cant get any ideas need help with it
解决方案
Hi, let's break down your problem-
1. You need to search files in a given directory
Directory.GetFiles Method (String, String) (System.IO)[^]
How to: Read From Text Files in Visual Basic | Microsoft Docs[^]
2. Read a text file
How to: Read From a Text File (C# Programming Guide) | Microsoft Docs[^]
3. withSystem.IO.File.ReadAllLines
you'd be able to get the array of the lines, and populate each line in the textbox (TIP: usefor
loop. :) ).
Hope this helps.
KR
这篇关于在文本框中搜索文本文件,然后打开并编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文