如何在列表框中读取文本文件 [英] How to read text files in Listbox

查看:162
本文介绍了如何在列表框中读取文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想读取列表框中文本文件的所有行.我使用了普通对话框来定位文件.但是无法读取列表框中的文本.请尽快帮助我.....

I want to read all lines of text file in the listbox. i used common dialog to locate the file.But cant read the text in listbox.Please help me as soon as possible.....

推荐答案

出了什么问题?试试:
What is the problem? Try:
string[] lines = File.ReadAllLines(@"F:\Temp\justsometext.txt");
myListBox.Items.AddRange(lines);


这篇关于如何在列表框中读取文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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