vb.net - Add several .jpg's from file to image array -
vb.net - Add several .jpg's from file to image array -
i'll maintain short , simple... asked question before, wasn't answered. i'd several images folder, , add together them array. not working, can explicitly tell me how it? thanks!
on form load:
private sub button1_add(byval sender system.object, byval e system.eventargs) handles button1.click dim picturearray new list(of image) each item string in directory.getfiles("c:\users\turcotd\desktop\itlpers", "*.jpg", io.searchoption.alldirectories) dim _image image = image.fromfile(item) picturearray.add(_image) next if (i < 6) dim pb new picturebox me.flowlayoutpanel1.controls.add(pb) pb.image = picturearray(i) = + 1
thanks!!!
first, i've showed how images of directoryinfo not fileinfo above!
i've used strong typed list(of fileinfo)
in my reply on previous question instead of array because it's lot better, even arraylist. can access items in list same access items in array(via index or "foreach").
if anyway insist on using array, need utilize toarray-extension instead of tolist. example:
dim imagearray = dir.getfiles("*.jpg", io.searchoption.alldirectories).toarray
look @ fileinfo-class farther informations. illustration need phone call fileinfo.name image-name(filename without path) or fileinfo.fullname full-path.
so should work:
dim dir = new io.directoryinfo("c:\users\turcotd\desktop\itlpers") dim images = dir.getfiles("*.jpg", io.searchoption.alldirectories).tolist dim pictures new list(of picturebox) each img in images dim image new picturebox picture.image = image.fromfile(img.fullname) pictures.add(picture) next
vb.net winforms
Comments
Post a Comment