|
Answer» Hi FOLKS
I have about 52 image FILES in a folder call resources and as you would want to know, i am making a card game. I want to write a short code to LOAD all images to an array by using some statement but the problem is that i also need to use the image file name to work with some logic.
For examples: I have an image called 2H, 3H, 4H, 8C, 9C, AS and so on Having to know that 2H is 2 of hearts and AS is Ace of spade I called these files on purpose so i can use numbers and string easily, while working with substring.
So i am looking to get something like this, if it is helpful
For i = 0 to 51 image(i) = image.fromfile(directory) next
the next things is that i want to use image(i) file name for some other uses like image(i).filename.substring(0,1)
Obviously you cant do it with this code but i would like to know WHETHER there is another method
Please Help Thank YouIs ok now i have SORT it out
Dim dir As New IO.DirectoryInfo("C:\") Dim fFile As IO.FileInfo Dim counter As Integer = 0 For Each fFile In dir.GetFiles("*.JPG") resCards(counter) = Image.FromFile(fFile.FullName) cards(counter) = fFile.Name counter += 1 Next
|