Results 1 to 9 of 9

Thread: How to Fix This?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2001
    Location
    Maumelle, AR
    Posts
    624

    How to Fix This?

    Ok, say I have the following array:

    People = Array("Jim", "Bob", "Sam")

    I know I need the third person in the array

    I want to search my array for the third item and set text1.text = to "Sam"

    How can I do this?

    Thanks

    -Jeremy
    Last edited by hipopony66; Jul 15th, 2002 at 07:10 PM.

  2. #2
    Frenzied Member Rick Bull's Avatar
    Join Date
    Apr 2002
    Location
    England
    Posts
    1,444
    Something like this?

    VB Code:
    1. For intLoopCounter = LBound(People) to UBound(People)
    2.     If People(intLoopCounter) = "Sam" Then
    3.         Text1.Text = People(intLoopCounter)
    4.     End If
    5. Next intLoopCounter

  3. #3
    PowerPoster Arc's Avatar
    Join Date
    Sep 2000
    Location
    Under my rock
    Posts
    2,336
    If you know you need the third item then you would just say


    Text1=Myarray(2)
    -We have enough youth. How about a fountain of "Smart"?
    -If you can read this, thank a teacher....and since it's in English, thank a soldier.


  4. #4
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    Worth a mention :

    The code provided will crap out if the array has not been initailized...
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  5. #5
    PowerPoster Arc's Avatar
    Join Date
    Sep 2000
    Location
    Under my rock
    Posts
    2,336
    If you know you need the third item then you would just say


    Text1=Myarray(2)
    -We have enough youth. How about a fountain of "Smart"?
    -If you can read this, thank a teacher....and since it's in English, thank a soldier.


  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2001
    Location
    Maumelle, AR
    Posts
    624

    Initialized???

    I declare the array in my Form_Load event. I think this is not working though as James said, because it works on some files and NOT others. Two files will have the same genre # assigned to them and one will read something like "Gothic Rock" , but the file right after it that has the SAME genre # will read "Progressive Rock". Progressive Rock follows Gothic Rock in the array. How can I fix this problem and read the CORRECT genre every time? Any help is appreciated.

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2001
    Location
    Maumelle, AR
    Posts
    624

    and......

    It's like it get's confused or something.

  8. #8
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    Your 1st example doesn't quite describe exactly what you are trying to do...

    Please explain a little more...are your trying to loop and "pull out" all Gothic Rock in the array?
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2001
    Location
    Maumelle, AR
    Posts
    624

    Ok here it is..........

    I'm reading the genre field of and ID3v1.1 tag. The genre field of an ID3 v1.1 tag is only one byte. the way it works is a number is assigned to each genre, and that number corresponds to the genre name in an Array. So when I do this:

    getid3.genre

    This returns a number between 0 & 128. So in the Array, Classic Rock would be 1.

    Ex.

    Matrix = Array("Blues", "Classic Rock", etc.)


    The problem is I'm using this code:
    VB Code:
    1. tmpgenre= getid3.genre
    2. i.subitems(5)=Matrix(tempGenre)

    I'm looping through each listitem in a listview and assigning the Textname to the number. Does this make more sense now?

    And since "Gothic Rock" is 91 and "Progressive Rock" is 92 it gets off by one occasionally. But if the number is 1 then it changes it correctly to "Classic Rock" So it gets confused or something going through the array. I need to fix this so it converts the number to the correct genre. Hope this makes more sense. Thanks for any help you can give.

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