i have code around bane of everyone's existence
delegate int getselectedindicescountcallback(listbox thing); private int getselectedindicescount(listbox thing) { if (this.invokerequired) { getselectedindicescountcallback d = new getselectedindicescountcallback(getselectedindicescount); invoke(d, new object[] { thing }); } else { return thing.selectedindices.count; } return 0; }
the return 0 being there because it'd error without it. however, returns 0. don't know how return other value.
the call control.invoke return value of method. have cast int
, return it.
return (int)invoke(d, new object[] { thing });