vb.net - image is not a member of system.windows.forms.control -


i have 10 imagebox named imagebox1,imagebox2.....imagebox10

when click button , runs sub called "load" loads images imagelist imageboxes in loop

private sub load(byval task string) dim j integer , ctl1 control j = 1 10 ctl1 = controls(" picturebox" & format(j))    ctl1.image = imglistpics.images(j) 'thİs lİne gİves error(image not member of system.windows.forms.control) ctl.visible = true   'thİs lİne works next    end sub 

i've tried 1 instead. gives error "system.nullreferenceexception". imagelist not null!

ctype(ctl1, picturebox).image = imglistpics.images(j) 

you should this

    dim j integer, ctl1 picturebox     j = 1 10         ctl1 = ctype(controls("picturebox" & format(j)), picturebox)         ctl1.image = imglistpics.images(j - 1) 'note: image index starts 0         ctl1.visible = true      next 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -