Searching textbox?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • brandon01
    New Member
    • Jan 2008
    • 3

    Searching textbox?

    Anyone have any idea how to search a textbox for a word and get the next word after it in vb6?

    example:

    "message" "hello"

    The code should get the 2nd word, "hello".

    I've been trying to find a way to do this, so far I can search for a word but can't find a way to ignore the space character between the words and copy the 2nd word up to the next space character.

    Thx...
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    Kindly post your code for reference of our experts.

    Comment

    • werks
      New Member
      • Dec 2007
      • 218

      #3
      I recommend this site for you PsCode just search for it. ok? Good Luck..

      --
      Kenneth
      "Better Than Yesterday"

      Comment

      • Bum
        New Member
        • Jan 2008
        • 19

        #4
        use something like

        dim tstr as string 'the string you are trying to find

        ''look for word
        dim i
        i = instr(textbox.t ext,"message")

        'look for space after word
        dim k
        k = instr(i + 1,textbox.text, " ")

        'look for space after first space, and if j returns zero then the word you want is the last word

        dim j
        j = instr(k + 1,textbox.text, " ")
        if j <> 0 then tstr = trim(mid(textbo x.text,k + 1,j-k)
        if j = 0 then tstr = trim(right(text box.text,len(te xtbox.text) - k)))

        something like that. Hope it helps,

        B

        Comment

        Working...