Results 1 to 4 of 4

Thread: how do I search a text box

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    how do I search a text box for something like "< body . >"
    Code:
    < body . >
    and it must be in that order.... also if I find something how can I add stuff right after the . (dot) and space?
    NXSupport - Your one-stop source for computer help

  2. #2
    Guest
    Use the Instr function.

    Code:
    If Instr(Text1.text, "<body . >") Then
    Msgbox "string found!"
    Else
    Msgbox "string not found!"
    End If

  3. #3
    Guest
    This will add str3 in between the . and > as well

    Code:
    Private Sub Command1_Click()
    
    Dim pos As Integer
    Dim str1, str2, str3 As String
    'str1 - text before the .
    'str2 - text after the .
    'str3 - the string you want to add
    
    str3 = "TEST"
    
    'pos + 7 is the position of the .
    pos = InStr(Text1.Text, "< body . >") + 7
    
    str1 = Left(Text1.Text, pos)
    str2 = Mid(Text1.Text, pos + 1)
    
    Text1.Text = str1 & str3 & str2
    End Sub
    Sunny

  4. #4
    Guest
    To add something right after the dot and space:

    Code:
    Private Sub Command1_Click()
    If InStr(Text1.Text, "<body . >") Then
    Text1.Text = Replace(Text1.Text, "<body . >", "<body . (replace here)>")
    Else
    End If
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width