multithreading - vb.net delegates don't seem to be working -


in vb.net, trying use delegates update control on form thread, doesn't change on form. i've confirmed is,in fact, receiving data(so it's not blank), reason won't send data control.

delegate sub fupdatedelegate(byval itemtoadd string) dim myupdate fupdatedelegate = addressof updatefrmlist  private sub updatefrmlist(byval itemtoadd string)      form1.listbox1.items         .add(itemtoadd)     end     msgbox(itemtoadd) end sub 

and called as

if form1.listbox1.invokerequired    form1.listbox1.begininvoke(myupdate) end if 

how can make adds items listbox? (this being run module)

try modifying sub deal invoke. call item add.

private sub updatefrmlist(byval itemtoadd string)     if me.invokerequired         me.begininvoke(myupdate, itemtoadd)     else         listbox1.items             .add(itemtoadd)         end         ' msgbox(itemtoadd)     end if end sub 

all calls

 updatefrmlist(somestring) 

Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -