Results 1 to 4 of 4

Thread: contains

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2009
    Posts
    462

    contains

    im useing this code right now

    If i.Contains("1") Then
    MsgBox("2")
    Else
    End If

    but what i want to do it have it check multiple text like this

    If i.Contains("1") or ("2") or ("3")Then
    MsgBox("H2")
    Else
    End If

    but that doesnt work anyone want to help

  2. #2
    Junior Member
    Join Date
    Apr 2009
    Posts
    30

    Re: contains

    If i.Contains("1") or i.Contains("2") or i.Contains("3")Then
    MsgBox("H2")
    End If

    I think this should work.

  3. #3
    Master Of Orion ForumAccount's Avatar
    Join Date
    Jan 2009
    Location
    Canada
    Posts
    2,802

    Re: contains

    This is easier then writing out or statements for each one, and it can be as long as you want:

    vb.net Code:
    1. Dim chrContains() As Char = {"1"c, "2"c, "3"c}
    2. If i.IndexOfAny(chrContains) Then
    3.      MessageBox.show("H2")
    4. End If

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2009
    Posts
    462

    Re: contains

    thanks guys they both worked

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