Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First, i've showed you how to get the images of a <a href="http://msdn.microsoft.com/en-us/library/system.io.directoryinfo.aspx" rel="nofollow noreferrer">DirectoryInfo</a> not from a FileInfo like above!</p> <p>I've used a strong typed <code>List(Of FileInfo)</code> in <a href="https://stackoverflow.com/a/8842768/284240">my answer on your previous question</a> instead of an Array because it's a lot better, <a href="http://blog.drorhelper.com/2008/10/why-should-i-use-list-and-not-arraylist.html" rel="nofollow noreferrer">even than an ArrayList</a>. You can access the items in a List the same you would access the items in an Array(via Index or "foreach").</p> <p>If you anyway insist on using an Array, you simply need to use the <a href="http://msdn.microsoft.com/en-us/library/bb298736.aspx" rel="nofollow noreferrer">ToArray-Extension</a> instead of <a href="http://msdn.microsoft.com/en-us/library/bb342261.aspx" rel="nofollow noreferrer">ToList</a>. For example:</p> <pre><code>Dim imageArray = dir.GetFiles("*.jpg", IO.SearchOption.AllDirectories).ToArray </code></pre> <p>Look at the <a href="http://msdn.microsoft.com/en-us/library/system.io.fileinfo.aspx" rel="nofollow noreferrer">FileInfo-Class</a> for further informations. For example you need to call <a href="http://msdn.microsoft.com/en-us/library/system.io.fileinfo.name.aspx" rel="nofollow noreferrer">FileInfo.Name</a> to get the image-name(filename without path) or <a href="http://msdn.microsoft.com/en-us/library/system.io.filesysteminfo.fullname.aspx" rel="nofollow noreferrer">FileInfo.FullName</a> to get the Full-Path. </p> <p>So this should work:</p> <pre><code>Dim dir = New IO.DirectoryInfo("C:\Users\turcotd\Desktop\ITLPers") Dim images = dir.GetFiles("*.jpg", IO.SearchOption.AllDirectories).ToList Dim pictures As New List(Of PictureBox) For Each img In images Dim picture As New PictureBox picture.Image = Image.FromFile(img.FullName) pictures.Add(picture) Next </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload