Private Sub cmdSearch_Click()
Dim txt1 As String, txt2 As String
Dim firstS As Integer, lastS As Integer
txt1 = txtinput1.Text
txt2 = txtinput2.Text
firstS = InStr(txt1, txt2)
If firstS <> 0 Then
lbldisplay1.Caption = " Forward Search The text was found ast position " & firstS
Else
lbldisplay1.Caption = " Forward Search The text was Not found"
End If
lastS = InStrRev(txt1, txt2)
If lastS <> 0 Then
lbldisplay2.Caption = " Backward Search The text was found ast position " & lastS
Else
lbldisplay2.Caption = " Backward Search The text was Not found"
End If
End Sub