VB,Listvier控件从TXT文档导入数据

来源:百度知道 编辑:UC知道 时间:2024/05/16 11:03:33
从txt文档导入形如:"123456---abdcdfe---张三" 的数据
怎么实现?

读取文本文件,不用我说了吧?
Dim S as String
Open "C:\a.txt" for input as #1
While Not EOF(1)
Line Input #1,s
A=SPlit(S,"---")
Set Itmx = listView1.ListItems.Add(, , A(0))
Itmx.SubItems(1) = A(1)
Itmx.SubItems(2) =A(2)
Wend
Close #1

按行读文件会吧?
读到数据后,将字符串格式化后显示到LV里即可。
有问题可以M喔。