I have 1 ListBox with files names, obtained with this code:
Dim files As New List(Of String)
files.AddRange(IO.Directory.GetFiles(Xpath, "*.txt").
Select(Function(f) IO.Path.GetFileNameWithoutExtension(f)))
I want to load at PictureBox a list of images with the same initial name.
Example: If i select "house" Item at ListBox, I want to get (for show) all images starting with the same string. In this example the files "houses.jpg", "house 1.jpg", "house 2.jpg" "house 2 backyard.jpg", "house(4).jpg","house roof.jpg", and anyother found (on the same directory) must be shown at picturebox...
How can i list/get the (in part) same named files? to use at PictureBox (I suppose this must filter and exclude the original .txt to avoid errors). The files are into a static folder inside program's path. Its easy to load 1 image of each file with exactly same name, I use:
PictureBox1.image = (Application.StartupPath & "\buildings\" & ListBox1.SelectedItem.ToString & ".jpg")
but my purpouse is detect and use more than 1 image with the same part name when it exist
Maybe the first step is create a kind of list of them... but I don't have idea.