Search Tools Links Login

Search and Highlight


Visual Basic 6, or VB Classic

Find a string in a textbox and highlight

Private Function FindString (Control As Control, FindStr As String, Optional StartPos As Integer = 1 ) As Boolean
   Dim a As Integer
   a = InStr(StartPos, LCase$(Control.Text), LCase$(FindStr))
   If a = 0 Then
      FindString = False
   Else
      FindString = True
      Control.SetFocus
      Control.SelStart = a - 1
      Control.SelLength = Len(FindStr)
   End If
End Sub

About this post

Posted: 2020-08-30
By: vb6boy
Viewed: 257 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.