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

C# random value from dictionary and tuple -

cgi - How do I interpret URLs without extension as files rather than missing directories in nginx? -

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