如题。

解决方案 »

  1.   

    手写的,可能有错:dim mbyte() as byte
    dim mlen as long
    dim filename as string
    filename="c:\test.txt"
    mlen=filelen(filename)
    redim mbyte(mlen-1)
    open filename for binary as #1
    get #1,,mbyte
    close #1
    dim s as string
    s=strconv(mbyte,vbunicode)
    dim arr
    arr=split(s,vbcrlf)
    '文件行数为mline+1
    dim mline as long
    mline=ubound(arr)
    '第n行的内容为,arr(n-1)
    dim linestr as string
    linestr=arr(5)
      

  2.   

    dim stra as string,al as long
    open "..." for input as #1
        al=1
        while not eof(1)
            line input #1,stra '?line input stra,#1
            al=al+1
        wend
        stra=""
    close #1
    al为行数
      

  3.   

    http://expert.csdn.net/Expert/topic/2250/2250384.xml?temp=.6102869
      

  4.   

    试试FileSystemObjectDim K As New FileSystemObject, L As TextStream
    Set L = K.OpenTextFile("C:\WINDOWS\upgrade.txt")
    Do Until L.AtEndOfStream
        L.SkipLine
    Loop
    MsgBox L.Line-1
      

  5.   

    要想加快速度,应以数据库方式操作文本文件,注意配置好ini文件
      

  6.   

    Dim Lines, chars As String
    Dim blah() As String
    Dim bleh() As String
    Dim Curline As String
    Dim CurChar, TotalChar As String
    Curline = Mid(Text1.Text, 1, Text1.SelStart)
    blah() = Split(Curline, Chr$(10))
    bleh() = Split(Text1.Text, Chr$(10))
    If Text1.SelStart = 0 Then
    CurChar = 0
    Curline = 1
    If Len(Text1.Text) = 0 Then
    TotalChar = 0
    Else
    TotalChar = Len(Text1.Text) - (UBound(bleh) * 2)
    End If
    Else
    CurChar = Text1.SelStart - (UBound(blah) * 2)
    Curline = UBound(blah) + 1
    TotalChar = Len(Text1.Text) - (UBound(bleh) * 2)
    End If
    Lines = "行数:第 " & Curline & " 行/共 " & SendMessage(Text1.hWnd, EM_GETLINECOUNT, ByVal 0&, ByVal 0&) & " 行"
    chars = "字节:第 " & CurChar & " 字节/共 " & TotalChar & " 字节"
    sb2.SimpleText = chars & "  " & Lines