|
-
Jul 15th, 2002, 03:28 PM
#1
Thread Starter
Fanatic Member
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.
-
Jul 15th, 2002, 03:57 PM
#2
Frenzied Member
Something like this?
VB Code:
For intLoopCounter = LBound(People) to UBound(People)
If People(intLoopCounter) = "Sam" Then
Text1.Text = People(intLoopCounter)
End If
Next intLoopCounter
-
Jul 15th, 2002, 04:16 PM
#3
PowerPoster
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.

-
Jul 15th, 2002, 04:17 PM
#4
PowerPoster
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....
-
Jul 15th, 2002, 04:30 PM
#5
PowerPoster
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.

-
Jul 15th, 2002, 06:51 PM
#6
Thread Starter
Fanatic Member
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.
-
Jul 15th, 2002, 06:52 PM
#7
Thread Starter
Fanatic Member
and......
It's like it get's confused or something.
-
Jul 15th, 2002, 07:17 PM
#8
PowerPoster
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....
-
Jul 15th, 2002, 07:49 PM
#9
Thread Starter
Fanatic Member
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:
tmpgenre= getid3.genre
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|