首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VB Dotnet >

怎样用vb.net读取csv文件?死了!

2012-09-10 
怎样用vb.net读取csv文件?急。。。死了!在线等!那位高手能给我个例子用vb.net读取cav文件阿,一次性读出来就行

怎样用vb.net读取csv文件?急。。。死了!在线等!
那位高手能给我个例子用vb.net读取cav文件阿,一次性读出来就行了!

[解决办法]
csv文件就是文本文件,你可以用以下函数来读取:

VB.NET code
    Public Function GetTxtFile(ByVal TxtFn As String) As String()        Dim sr As IO.StreamReader        Dim tmpstr As String        Dim R() As String        Dim Rn As Long        sr = IO.File.OpenText(TxtFn)        tmpstr = sr.ReadLine()        Rn = 0        While Not tmpstr Is Nothing            ReDim Preserve R(Rn)            R(Rn) = tmpstr            tmpstr = sr.ReadLine()            Rn += 1        End While        sr.Close()        Return R    End Function 

热点排行