Monday, 15 August 2011

vb.net set images to picturebox one by one -



vb.net set images to picturebox one by one -

i have performed next steps in vb.net code:

from text file , lines contain values want, in case, need lastly value "group"

create picturebox array, number of pictureboxes number step 1. 1 row has 2 pictureboxes.

after want set image read text file pictureboxes 1 1 ( image name 2nd value.jpg), haven't found proper way this.

any advice on it?

my text file follows:

my code till is:

private picboxarray(9) picturebox dim value0 string dim value1 string dim value2 string dim value3 string dim filename string = "d:\local\mytest1.txt" dim substring1 string = "group" dim lines string() = file.readalllines(filename) integer = 0 lines.length - 1 if lines(i).contains(substring1) count1 += 1 end if next = 1 count1 picboxarray(i) = new picturebox picboxarray(i) .tag = .size = new size(330, 280) if mod 2 = 0 .location = new point(430, 80 + 300 * ((i - 2) / 2)) else .location = new point(80, 80 + 300 * ((i - 1) / 2)) end if .parent = me .visible = true end next using myreader new microsoft.visualbasic. fileio.textfieldparser("d:\pub_gis_tagging\local\mytest.txt") dim linecount = file.readalllines("d:\pub_gis_tagging\local\mytest.txt").length myreader.textfieldtype = fileio.fieldtype.delimited myreader.setdelimiters(",") dim currentrow string() while not myreader.endofdata seek currentrow = myreader.readfields() value0 = currentrow(0) value1 = currentrow(1) value2 = currentrow(2) value3 = currentrow(3) if value3 = "group" '======= set image picboxarray(1) picboxarray(count1) 1======== '====================== stuck here============= end if grab ex microsoft.visualbasic. fileio.malformedlineexception msgbox("line " & ex.message & "is not valid , skipped.") end seek end while end using

i assume want read line file , set image line first picturebox , read next line , set next image next picturebox?

dim linecounter integer = 0 while not myreader.endofdata seek currentrow = myreader.readfields() value0 = currentrow(0) value1 = currentrow(1) value2 = currentrow(2) value3 = currentrow(3) if value3 = "group" picboxarray(linecounter).imagelocation = "c:\vb_test\" & value1 & ".pdf.jpg" linecounter += 1 end if next

vb.net picturebox

No comments:

Post a Comment