小萝莉 通过本文主要向大家介绍了c#listbox用法,c#listbox,c#listbox显示数据,c#checkedlistbox,c#listbox绑定数据等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
本文实例讲述了C#读取文本文件到listbox组件的方法。分享给大家供大家参考。具体实现方法如下:
private void AddTxtToLst(string path,ListBox lst)
{
StreamReader file = new StreamReader(path,Encoding.Default);
string s = "";
while (s != null)
{
s = file.ReadLine();
if (!string.IsNullOrEmpty(s))
lst.Items.Add(s);
}
file.Close();
}
</div>
希望本文所述对大家的C#程序设计有所帮助。
</div>
