如何在vb6中将文本文件值显示到listview [英] how to display the textfile values to listview in vb6

查看:408
本文介绍了如何在vb6中将文本文件值显示到listview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,



我是vb6中的新手,现在我需要将文本文件显示为listview格式。



i的文本文件名是post.txt,现在我想在vb6中将这些文本文件的详细信息显示为listview格式,这些listview有四列长度,如 postalcode(6),addresstype( 1),buildingnumber(7),streetkey(7),buildingkey(6)



我的文本文件是:



/这里019191 - 邮政编码,K-addresstype,31 -buildingnumber,MAR0043-streetkey,MAR036-building key



019191K31 MAR0043MAR036

019392K20 MAR0042

019393K26 MAR0042GAR006

019394K28 MAR0042GAR006

019395K30 MAR0042GAR006

019596K5 MAR0041

118484K PAS0007PAS039

038983K3 TEM0002SUN048

048425U21 TEL0003

048426U23 TEL0003

048427U25 TEL0003

048428U27 TEL0003

908005P ROB004

908006P ROB004

908007W ROB004

908005P ROB004



< br $>


i serach alredy很多网站但没有帮助,我希望通过codeproject找到解决这个问题的方法。



如果有人知道解决方案请分享和广告vise me。



谢谢,

renga

Hi friends,

i''m new in vb6,now i need to display the textfile to listview format.

i have the textfile name is post.txt ,now i want to display those text file details to listview format in vb6,these listview have a four columns with length like postalcode(6),addresstype(1),buildingnumber(7),streetkey(7),buildingkey(6).

my textfile is:

/here 019191 - postalcode,K-addresstype,31-buildingnumber,MAR0043-streetkey,MAR036-building key

019191K31 MAR0043MAR036
019392K20 MAR0042
019393K26 MAR0042GAR006
019394K28 MAR0042GAR006
019395K30 MAR0042GAR006
019596K5 MAR0041
118484K PAS0007PAS039
038983K3 TEM0002SUN048
048425U21 TEL0003
048426U23 TEL0003
048427U25 TEL0003
048428U27 TEL0003
908005P ROB004
908006P ROB004
908007W ROB004
908005P ROB004



i serach alredy many sites but not helpful,i hope i find the solution for this problem via codeproject.

if anybody know the solution for this please share and advise me.

thanks,
renga

推荐答案

此代码是对于vb.net bt与vb6差别不大,你可以改变它..

this code is for vb.net bt not much diffrence for vb6 you can change it..
Dim sr As StreamReader = New StreamReader("Your File Path")
 Dim Arr() As String
 Dim line As String
 While sr.Read
     If sr.EndOfStream Then
         Exit While
     End If
     line = sr.ReadLine
     Arr = line.Split(",")
     ListView1.Items(0).Text = Arr(0) 'Assign your listview acc to your need
     ListView1.Items(1).Text = Arr(1)
     ListView1.Items(2).Text = Arr(2)
     ListView1.Items(3).Text = Arr(3)
 End While


这篇关于如何在vb6中将文本文件值显示到listview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆