c# - Unable to Update ListBox Right way from backgroundWorker1.ReportProgress -


trying update listbox backgroundworker1_progresschanged, , when backgroundworker1_dowork completes process. want update listbox before backgroundworker1_dowork still executing , while periodically call backgroundworker1.reportprogress , update listboxes.

private void backgroundworker1_dowork(object sender, doworkeventargs e) {     // loops     backgroundworker1.reportprogress(1, list);// sending list listbox }  private void backgroundworker1_progresschanged(object sender, progresschangedeventargs e) {     dynamic = e.userstate;     begininvoke((methodinvoker)delegate               { listbox1.items.add(a[0]); });     // updates after backgroundworker1_dowork executed? } 

answer: please add delay

private void ondatareceived(object sender, datareceivedeventargs e) {   if (!string.isnullorempty(e.data)) {     backgroundworker1.reportprogress(1, e.data);     system.threading.thread.sleep(300);   } } 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -