Dim selt As String
Private Sub Command1_Click()
If Text1.SelLength > 0 Then
stt = CStr(Text1.Text)
If Text1.SelStart = 0 Then
selt = Left(stt, Text1.SelLength)
Else
selt = Mid(stt.Text1.SelStart, Text1.SelLength)
End If
Command2.Enabled = True
End If
End Sub
Private Sub Command2_Click()
Text1.Text = Left(Text1.Text, Text1.SelStart) + Right(Text1.Text, Len(Text1.Text) - Text1.SelStart - Len(selt))
Command2.Enabled = False
End Sub
Private Sub Command3_Click()
Text1.Text = Left(Text1.Text, Text1.SelStart) + selt + Right(Text1.Text, Len(Text1.Text) - Text1.SelStart)
End Sub
Private Sub Command4_Click()
Dim search As String
Dim pos As Integer
search = InputBox("输入需要查找字符:")
pos = InStr(Text1.Text, seach)
If pos Then
Text1.SelStart = pos - 1
Text1.SelLength = Len(search)
Text1.SetFocus
Else
MsgBox "找不到你想找的字符."
End If
End Sub
上面是一个记事本的代码,但查找功能不能实现,请问哪里出现问题?