111,092
社区成员




//如何在textbox里显示txt文件的内容
04. string path = @"D:/test.txt";//读取文件txt
06. using (FileStream fs = new FileStream(path, FileMode.Open))
07. {
08. using (StreamReader sr = new StreamReader(fs))
09. {
10. while (!sr.EndOfStream)
11. {
12. string sLine = sr.ReadLine();
13. if (sLine.Length < 1)
14. {
15. continue;
16. }
17. string[] sRecordKbn = sLine.split(' ');//过滤空格
18. forach(string s in sRecordKbn )
{
//s是取出的数据。你可以插入数据库
}
}
21. }
22. }
23.