c# - Update Main UI With RichTextBox Data from BackgroundWorker -
i have program querys bunch of wmi, registry, , other data. formats data various richtextboxes highlighting errors data scanned on remote computer.
i want separate different parts of scan different threads complete in fraction of time. working part, don't know how return richtextbox backgroundworker. forces me pass object, , object can return plain text (afaik). tells me can't update richtextbox thread.
after have backgroundworker query , format richtextbox, how data displayed on main ui?
the dowork
portion of backgroundworker
should assign text display in richtextbox
control e.result
. not have plain text... e.result object
. don't want touch of ui controls in section of backgroundworker... you're in background thread, not main ui thread.
the runworkercompleted
portion executed next. object assigned in dowork section available in e.result
. you're in main ui thread now, cast object whatever type need , assign richtextbox
control.
read threading in c#: backgroundworker joseph albahari more information.
Comments
Post a Comment