要求是 :分几次读出来,基本上是先读第一个换行符前的字符,然后延时一段时间,再读第二个换行符前的字符,依次类推。
还有就是当读到当前这段时,该段文字可否用特殊的字体或是颜色来重点标出

解决方案 »

  1.   

    你要实现什么功能?是不是类似字幕功能?
    你可以用Timer控件来作延时,用Label显示,比如:
    Label1.ForeColor = &HFF&   '字体显示红色
      

  2.   

    是指读文件还是指根据换行符分隔??
    前者,用scripting 或io读写都行后者,用split
    temp=split("aa" & vbcrlf & "bb" & vbcrlf & "cc",vbcrlf,-1)
    msgbox temp(1) '呵呵,结果应该是 "aa"至于定时,如果对系统占用率的要求不是很严格,timer足矣
      

  3.   

    用timer应该可以吧!
    Label1.ForeColor = vbred  '字体显示红色
                       vbblue '^^^^^^^兰色 
    ……………………………………………………………………
      

  4.   

    不想另外多一个控件(Timer),你很难做到一段时间从文本框中读一定的数据,
    ‘以回车键为分割,一次读一个回车键前的数据’是可以做到的。
      

  5.   

    用line input可以做到一次读一行。第二问题没看懂  :(
      

  6.   

    错了,从文本框读取字符串不能用line input。
    我觉得应该用instr来查找vbnewline的方法比较好。
      

  7.   

    以下是我帮你写的测试程序,看看这样的效果行不行。:
    使用方法:新建一个文本文件,将下面的内容复制进去,然后将该文件的后缀名改为frm,再用VB打开。VERSION 5.00
    Begin VB.Form Form1 
       BorderStyle     =   1  'Fixed Single
       Caption         =   "Form1"
       ClientHeight    =   5790
       ClientLeft      =   45
       ClientTop       =   330
       ClientWidth     =   7935
       LinkTopic       =   "Form1"
       LockControls    =   -1  'True
       MaxButton       =   0   'False
       ScaleHeight     =   5790
       ScaleWidth      =   7935
       StartUpPosition =   3  '窗口缺省
       Begin VB.CommandButton Command1 
          Caption         =   "Input(&I)"
          Height          =   375
          Left            =   3240
          TabIndex        =   1
          Top             =   5280
          Width           =   1335
       End
       Begin VB.TextBox Text1 
          Height          =   4575
          Left            =   60
          MultiLine       =   -1  'True
          ScrollBars      =   3  'Both
          TabIndex        =   0
          Text            =   "Form1.frx":0000
          Top             =   480
          Width           =   7695
       End
       Begin VB.Label lblShow 
          Height          =   255
          Left            =   60
          TabIndex        =   2
          Top             =   120
          Visible         =   0   'False
          Width           =   7695
       End
    End
    Attribute VB_Name = "Form1"
    Attribute VB_GlobalNameSpace = False
    Attribute VB_Creatable = False
    Attribute VB_PredeclaredId = True
    Attribute VB_Exposed = False
    Option Explicit
    Private Declare Function GetTickCount Lib "kernel32" () As LongPrivate Sub Command1_Click()
    Dim i As Integer, iCount As Integer, LineCount As Integer
    Dim strTemp As String
    Dim nTime As LongIf Text1.Text <> "" Then
    Text1.SetFocus
    lblShow.Visible = True
    LineCount = 1
       Do
       lblShow.Caption = "正在读取第" + Trim(Str(LineCount)) + "行..."
       i = InStr(iCount + 1, Text1.Text, vbNewLine, vbTextCompare)
          If i <> 0 Then
          Text1.SelStart = iCount
          Text1.SelLength = i - iCount - 1
          strTemp = Mid(Text1.Text, iCount + 1, i - iCount - 1)  '读出的数据在strTemp变量中
          LineCount = LineCount + 1
          iCount = i + 1
             nTime = GetTickCount    '以下过程为延时两秒。
             Do
             DoEvents
             Loop Until GetTickCount - nTime >= 2000
          Else
          Text1.SelStart = iCount
          Text1.SelLength = Len(Text1.Text) - iCount
             nTime = GetTickCount
             Do
             DoEvents
             Loop Until GetTickCount - nTime >= 2000
          Exit Do
          End If
       LooplblShow.Caption = "文件读取完毕! 共计读取了:" + Trim(Str(LineCount)) + "行"
    End If
    End SubPrivate Sub Form_Load()
    Dim strTemp As String'该过过程只是将一个文本文件的内容读入TextBox中供测试使用。
    '如果你的系统中没有这个文件,只要将:c:\Frunlog.txt改为一个已经存在的文本文件名即可。
    Open "c:\Frunlog.txt" For Input As #1
    Do
    Line Input #1, strTemp
    Text1.Text = Text1.Text + strTemp + vbNewLine
    Loop Until EOF(1)Text1.Text = Left(Text1.Text, Len(Text1.Text) - 2) '删除最后一个回车
    Close #1End Sub