multithreading - Accessing form control from within a thread using delegates in vb.net -
i have problem in updating form control thread using delegate.
this flow use.
dashboard screen(parent mdi window) -> quizscreen (child mdi window) once in quizscreen thread started , thread code kept in module(server.vb). thread need find , update control(which dynamically created)
following delegate code call inside thread
public sub changepictimage(byval ipaddress string) if me.invokerequired dim del nodedelegate del = addressof changepictimage me.invoke(del, ipaddress) 'return else me.backcolor = color.green me.backgroundimage = system.drawing.image.fromfile(application.startuppath & "\images\application-on.png") end if dim centerflowpanel flowlayoutpanel = ctype(quizscreen.centerflowpanel, flowlayoutpanel) dim computericonspanel flowlayoutpanel = ctype(centerflowpanel.controls("computericonspanel"), flowlayoutpanel) dim flowpanel flowlayoutpanel = ctype(computericonspanel.controls("flow_" + ipaddress), flowlayoutpanel) dim pictcontrol picturebox = ctype(flowpanel.controls("pict_" + ipaddress), picturebox) pictcontrol.image = system.drawing.image.fromfile(application.startuppath & "\images\application-on.png") end sub
i call delegate inside thread follows
threaddata.dashboard.changepictimage(ipaddress)
as may have noticed, have put delegate sub in dashboad.vb
i able find elements deepest level. infact can alert name , other properties when try set something. doesn't anything.
can me.
Comments
Post a Comment