读书人

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

发布时间: 2012-09-10 11:02:32 作者: rapoo

怎样用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 

读书人网 >VB Dotnet

热点推荐