日期:2014-05-17 浏览次数:20881 次
string fname = "C:\\Users\\wangyan\\Documents\\Visual Studio 2010\\ " + DateTime.Now.ToLongDateString() + ".txt";
StreamReader sr = new StreamReader(fname,Encoding.Default);
string vline;
while ((vline = sr.ReadLine()) != null)
{
string[] vitems = vline.Split( new char[]{','}, StringSplitOptions.RemoveEmptyEntries);
if (vitems.Length <= 0)
{
continue;
}
ListViewItem lvi = new ListViewItem();
lvi.Text = vitems[0];
for (int i = 1; i < vitems.Length; i++)
{
lvi.SubItems.Add(vitems[i]);
}
listView1.Items.Add(lvi);