Results 1 to 8 of 8

Thread: Searching for text

  1. #1

    Thread Starter
    Member king_willy's Avatar
    Join Date
    Sep 2001
    Location
    Sydney
    Posts
    61

    Searching for text

    Right. Good simple question.

    Got a textbox, full o' text'ly goodness.

    I want to search for, oh lets, say, the word "blah".
    in it

    If it finds it, returns true,
    if not; false.

    -and if anyone has some fancy code that will search for similar terms, please, dont hold back.

    cheers.
    In a world without fences, who needs GATES? The penguins are a comin'!

  2. #2
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429
    Like:
    VB Code:
    1. If InStr(1, Text1.Text, " blah ", vbTextCompare) <> 0 Then
    2.       MsgBox "True"
    3.    Else
    4.       MsgBox "False"
    5.    End If

    Using vbTextCompare will look for BLAH or BlAh etc.

    Note the Spaces before and after "blah"

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    If Instr(Text1.text,"mendhak") then
    msgbox "Found"
    else
    msgbox "not there"
    end if

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Originally posted by Bruce Fox
    Like:
    VB Code:
    1. If InStr(1, Text1.Text, "blah", vbTextCompare) <> 0 Then
    2.       MsgBox "True"
    3.    Else
    4.       MsgBox "False"
    5.    End If

    Using vbTextCompare will look for BLAH or BlAh etc.
    *takes out shotgun*

  5. #5
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429
    LOL

  6. #6

    Thread Starter
    Member king_willy's Avatar
    Join Date
    Sep 2001
    Location
    Sydney
    Posts
    61
    Cheers guys.

    Works like a charm.
    In a world without fences, who needs GATES? The penguins are a comin'!

  7. #7
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429
    No worries King W,

    On behalf of myself and Mendhak; your welcome.





    * Hands Mendhak a 12 guage cartridge......

  8. #8
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170


    I've lost my touch...

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