我用VB6制作的记事本不能写字

来源:百度知道 编辑:UC知道 时间:2024/06/16 20:03:33
我用VB6制作的记事本不能写字?哪出错了 高手指教下~

Global Pos As Integer
Global MatchCase As Boolean
Global SearchStr As String

Private Sub Check1_Click()
'单击“区分大小写”复选框,设置查找方式
If Check1.Value = 1 Then
MatchCase = True
Else
MatchCase = False
End If
End Sub

Private Sub Command1_Click()
'单击“查找”按钮的处理过程:
'1--根据是否“区分大小写”进行不同方式地查找
'2--如果找到,显示被找到的字符,否则,提示未找到信息

If MatchCase = True Then '如果以“区分大小写”方式查找
Pos = InStr(Pos + 1, FrmMain.Text1.Text, Text1.Text)
Else
Pos = InStr(Pos + 1, FrmMain.Text1.Text, Text1.Text, vbTextCompare)
End If

If Pos <> 0 Then '如果找到字符,则显示之
FrmMain.Text1.SelStart = Pos - 1
FrmMain.Text1.SelLength = Len(Text1.Text)
Else
MsgBox "没有找到字符 " & Chr$(34) & Text1.Text & Chr$(34)
End If
End Sub