Results 1 to 5 of 5

Thread: locate a string within a string

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2004
    Location
    Philippines
    Posts
    11

    locate a string within a string

    Good day.

    Iwant to know how to locate a string within a string. For example:

    --

    dim vrtual as string = "VB.NET and sql server programming"

    --

    I have a form that has a textbox that accepts string inputs, upon pressing the button the inputted string must be searched if it exists with the vrtual string. How do I do it, what command or function shoud I use?

    tnx for the help

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    If sXML.IndexOf("sql server") > -1 Then

    End If

  3. #3
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    HI,

    Safer to test for case.

    VB Code:
    1. If ucase(sXML).IndexOf(ucase(textbox1.text)) > -1 Then
    2.    Messagebox.Show("It's There")
    3. End If
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  4. #4
    Lively Member TLord's Avatar
    Join Date
    Jun 2004
    Posts
    95
    Originally posted by taxes
    HI,

    Safer to test for case.

    VB Code:
    1. If ucase(sXML).IndexOf(ucase(textbox1.text)) > -1 Then
    2.    Messagebox.Show("It's There")
    3. End If
    I agree with that, if you set option compare to binary only.
    Do you think my life is easy?
    Do you think it's good to win?
    do you think it's nice to kill?
    Do you think learning is a must?
    Do you think computers are nothing?
    Do you think this post is stupid?
    Do ypu think we're really humen?

    DO YOU THINK IT'S GOOD TO THINK AT ALL? ? ? ! ! !

  5. #5
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Originally posted by TLord
    I agree with that, if you set option compare to binary only.
    When I saw your post I automatically agreed with you but when I tested it I still needed to test for case even with Option Compare Text. Are you sure that Option Compare settings refer to object.Text values, or do they refer only to files? (I did rebuild my project after changing the Option Compare setting).
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

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