Results 1 to 3 of 3

Thread: arrays

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    188
    this is probably going to make me sound like I'm dumb... but, is there a function that will allow me to test if a string is equal to one of the values in an array of strings?

  2. #2
    Guest
    Try this:
    Code:
    Function CheckString(sIn As String) As Boolean
    
        MyStringArray = Array("One", "Two", "Three", "Four", "Five")
        For I = 0 To UBound(MyStringArray)
            If sIn Like MyStringArray(I) Then CheckString = True
        Next I
        
    End Function
    
    Private Sub Command1_Click()
    
        If CheckString("One") = True Then
            Print "Match Found"
        Else
            Print "Match not found"
        End If
    
    End Sub

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    188
    thanx... i was trying to do it without a for loop but I guess that won't work... I was trying to do it like "in" in an SQL statement... oh well...

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