| How do I write this substring code in Visual Basic?

How do I write this substring code in Visual Basic?

Robert Nesta M asked:


I am writing a Visual Basic program, and I’m wondering what to do.
I want to write an if/then statement, where IF a certain substring is contained anywhere in a string variable, THEN this certain event will execute. But I’m not sure how to do that. Help?

Related posts:

  1. Can i write BASIC or VISUAL BASIC programs on the internet? buckbucknumber2000 asked: I’d like to be able to write a...
  2. question for visual basic for calculate the sum of the number digits? ymdian asked: Write a Visual Basic program that will take...
  3. how to make a visual basic program to record a 2 pin connection on a serial port? baseballman999 asked: I run a retail store and i would...
  4. Can you give me the code for a cool program for Visual basic 2008? spongebob asked: Ok i got visual basic 2008 express edition...
  5. Visual Basic? Yahoo Manager asked: How would I write a visual basic...

Filed Under Programming & Design |

Tagged With ,

Comments

One Response to “How do I write this substring code in Visual Basic?”

  1. askMahesh on June 11th, 2009 4:53 am

    instr(1,”Today is a nice day.”,”nice”,vbTextCompare )

    use instr
    1 ==> position to start search
    “Today is a nice day.” ==> String you want to search in
    “nice” ==> String you are searching
    vbTextCompare ==> compare type, text means ignore case
    you can coose from binary and database compare

    Return value is 0==> means not found and actual position of search string if found.
    So you will be using
    IF instr()0 then ==> if the string is found