...

View Full Version : in array function



esthera
12-16-2006, 07:57 PM
can someone help me with how I would create a function that would take in an array and a value and check if that value exists in the array?

oracleguy
12-16-2006, 08:04 PM
Just off the top of my head:


Function inArray(byref array, byval data)

Dim found, arraylen, x
found = false
arraylen = ubound(array)

for x = 0 to arraylen
If array(x) = data Then
found = true
Exit For
End If
Next

inArray = found
End Function

I haven't tested it but that the gist of what you'd have to do.

ess
12-16-2006, 09:02 PM
sorry...thought it was a PHP question.

degsy
12-18-2006, 03:10 PM
Here is another example
http://forums.aspfree.com/code-bank-54/in-array-function-125932.html



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum