Image from Excel to vb.net Picturebox -
i have found many questions opposite vb.net excel none getting picture excel cell(row,column) picture box. app template gets strings of text excel file. works fine trying transfer pictures. have tried picspindle.image = shxl.cells(19, 2).value doesn't anything. not error out though!
will copy , paste work?
code:
imports system imports system.io imports system.text imports excel = microsoft.office.interop.excel public class form1 dim appxl excel.application dim wbxl excel.workbook dim shxl excel.worksheet dim raxl excel.range dim partid string dim refcard string private sub form1_activated(sender system.object, e system.eventargs) handles mybase.activated 'dispaly brembo logo piclogo.sizemode = pictureboxsizemode.stretchimage end sub private sub button1_click(sender object, e eventargs) handles button1.click 'read file source part number ******************example txt partid = ("19.n111.10") ' start excel , application object. appxl = createobject("excel.application") appxl.visible = false 'open reference card************************************************************************************* wbxl = appxl.workbooks.open("c:\users\aholiday\desktop\visual studios projects\reference card app\" & partid & ".xlsx") shxl = wbxl.worksheets("sheet1") ' copys reference card text cells app labels lblcode.text = shxl.cells(3, 9).value debug.print(lblcode.text) lblrev.text = shxl.cells(3, 13).value lbldate.text = shxl.cells(5, 9).value lblcustomer.text = shxl.cells(8, 2).value lblpart.text = shxl.cells(11, 2).value lblspindletype.text = shxl.cells(15, 2).value lblpainttype.text = shxl.cells(7, 6).value lbldunnagetype.text = shxl.cells(8, 8).value lblpartslayer.text = shxl.cells(11, 11).value lbllayers.text = shxl.cells(15, 11).value lbltotalparts.text = shxl.cells(20, 11).value lblpackaginginstructs.text = shxl.cells(20, 11).value 'works here! ' copys reference card pictures cells app pictureboxs picspindle.image = shxl.cells(19, 2).value picrotortop.image = shxl.cells(10, 6).value picrotorbottom.image = shxl.cells(19, 6).value picdunnagefinal.image = shxl.cells(10, 8).value picdunnagelayer.image = shxl.cells(19, 8).value ' close objects raxl = nothing shxl = nothing wbxl = nothing appxl.quit() appxl = nothing end sub end class
shxl.cells(19, 2).value and on won't work because pictures aren't store in cells on them meaning values of these cells nothing
try these links
Comments
Post a Comment