Finding an Element in an Array

Category:
Lists, Collections and Arrays
Type:
Snippets
Difficulty:
Intermediate
Author:
Anonymous

Version Compatibility: Visual Basic 6, Visual Basic 5

More information:
In VB5 and VB6, there is no "native way" of searching the elements of an Array for a match. This little snippet will help you do just that. If there's no match, it returns 0 (zero), if there is, it returns the index of the first match. Simply place this code into a function.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: