本帖最后由 jinzhuduan 于 2011-06-07 14:42:28 编辑

解决方案 »

  1.   

    本帖最后由 bdmh 于 2011-06-07 14:46:55 编辑
      

  2.   

    文本读取与分隔:
                StreamReader sr = new StreamReader("123.txt");      // 打开文本文件
                for (; ; )
                {
                    string str = sr.ReadLine();       // 读取一行
                    if (str == null)                  //
                        break;
                    string[] sArray = str.Split(','); // 按以','为分隔符提取字段
                }
                sr.Close();
      

  3.   

    把得到的字段插入ListvView        private void IntertToListview(string[] sArray)
            {
                ListViewItem item = new ListViewItem();
                for (int i = 0; i < sArray.Length; i++)
                {
                    ListViewItem.ListViewSubItem subitem = new ListViewItem.ListViewSubItem();
                    subitem.Text = sArray[i];
                    item.SubItems.Add(subitem);
                }
                listView1.Items.Add(item);
            }