We help IT Professionals succeed at work.
Get Started

vb .net arrays

Jimbo1954 asked
Last Modified: 2012-05-12
Hi Guys

  i have an array containing values from a split field in a database,

            (0)      "BRITANNIQUE" "      String
            (1)      "BIG"      String
            (2)      "BEAT"   String
            (3)      "BREAKBEAT"      String
            (4)      "ELECTRONIC"   String
            (5)      "HARDCORE"      String
            (6)      "BIG"      String
            (7)      "BEAT"      String

  I need a function that will loop through the array and return the index of the first matched word from select case function containing the values to match to, then move on

Select Case Trim$(genre)
            Case "BLUES" : Genreid = 0
            Case "CLASSIC ROCK" : Genreid = 1
            Case "COUNTRY" : Genreid = 2
            Case "DANCE" : Genreid = 3
            Case "DISCO" : Genreid = 4
            Case "FUNK" : Genreid = 5
            Case "GRUNGE" : Genreid = 6
            Case "ELECTRONIC" :
            Case "JAZZ" : Genreid = 8
            Case "Other" : Genreid = 9
This list is cut down, but in this case it should return Genreid = 7
because that is the first match, all the others would return genreid = 9 then move on
if it gets to the last index and still has no match then return genreid = 9 then move on

Watch Question
This problem has been solved!
Unlock 1 Answer and 18 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE