如何将listview行保存到多行文本框中

时间:2014-11-10 19:39:00

标签: listview textbox save

好的,我有一个包含5列的列表视图。我编写了下面的代码来获取文本和子项。使用,作为分隔符将它们添加到字符串中。它工作正常,但是我的代码将所有行保存在文本框中的一行上。我不确定问题出在哪里。请帮忙

  Dim fileName As String="inventory.lst"
    Dim row As String = "", theChar As String = ","
    Dim objWriter As New System.IO.StreamWriter(fileName)

    For Each item As ListViewItem In InvList.Items
        For Each subitem As ListViewItem.ListViewSubItem In item.SubItems
            row = row + subitem.Text + theChar
            'write to text file and remove last seperator
            objWriter.Write(row.TrimEnd(theChar))
        Next
    Next
    objWriter.Close()

1 个答案:

答案 0 :(得分:0)

尝试使用vbcrlf模拟2" next"

之间的输入