VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   2700
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4965
   LinkTopic       =   "Form1"
   ScaleHeight     =   2700
   ScaleWidth      =   4965
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command1 
      Caption         =   "结束"
      Height          =   495
      Index           =   3
      Left            =   3840
      TabIndex        =   4
      Top             =   1920
      Width           =   1095
   End
   Begin VB.CommandButton Command1 
      Caption         =   "查找下一个"
      Height          =   495
      Index           =   2
      Left            =   3840
      TabIndex        =   3
      Top             =   1320
      Width           =   1095
   End
   Begin VB.CommandButton Command1 
      Caption         =   "保存"
      Height          =   495
      Index           =   1
      Left            =   3840
      TabIndex        =   2
      Top             =   720
      Width           =   1095
   End
   Begin VB.CommandButton Command1 
      Caption         =   "打开"
      Height          =   495
      Index           =   0
      Left            =   3840
      TabIndex        =   1
      Top             =   120
      Width           =   1095
   End
   Begin VB.TextBox Text1 
      Height          =   2655
      Left            =   0
      MultiLine       =   -1  'True
      ScrollBars      =   3  'Both
      TabIndex        =   0
      Text            =   "sy09-07.frx":0000
      Top             =   0
      Width           =   3855
   End
   Begin MSComDlg.CommonDialog C1 
      Left            =   1560
      Top             =   2400
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click(Index As Integer)
    Select Case Index
    Case 0                  ' 打开文件
      Text1 = ""
      Dim s$
      C1.Filter = "*.txt|*.txt"
      C1.Action = 1
      Open C1.FileName For Input As #1
      Do While Not EOF(1)
         Line Input #1, s
         Text1 = Text1 + s + Chr(13) + Chr(10)
      Loop
      Close #1
    Case 1                ' 保存文件
      C1.Filter = "*.txt|*.txt"
      C1.Action = 2
      Open C1.FileName For Output As #1
      Print #1, Text1
      Close #1
    Case 2                  ' 查找定冠词The
      Text1.SetFocus
      Static j%                        ' 静态变量,保值,保留前一次查找到的位置
      j = InStr(j + 1, Text1, "The ")   ' 从原来找到的"The "下一个字符起继续查找
      If j > 0 Then
        Text1.SelStart = j - 1    '显示包括该j字符起的内容
        Text1.SelLength = 4
        j = j + 1
      Else
        MsgBox "找不到"
      End If
    Case 3                  ' 结束程序运行
      End
  End Select
End Sub
