c# - Backgroundworker to return a string[] array -
I am writing a program that uses a backgroundWorker1_doWork ()
, causing a constant String builds [] array and return it via DoWorkEventArgs e
, how do you do it? Thank you
If I understand your question correctly, you can e.result
Set the event handler with string []
array in backgroundWorker1_doWork ()
and then use it in the RunWorkerCompleted
event handler.
The following is the code that I have written in the form of victory.
background work = null; Private Zero Button 1_Click (Object Sender, EventArgs E) {Work = new background (by;); Work.DoWork + = New DoWorkEventHandler (work_DoWork); Work.RunWorkerCompleted + = New Runawoulder Cooled event handler (work_RunWorkerCompleted); Work.RunWorkerAsync (); } Zero Work_Worker (Object Sender, Run Worker Compatibility Aventus E) {string [] arr = (Results as E. String []); Foreign Currency (different items in ARM) {message box. Show (item); }} Null work dockwork (object sender, DoWorkEventArgs e) {string [] arr = new string [3]; Arr [0] = "AA"; Arr [1] = "BB"; Arr [2] = "cc"; E. Results = arr }
Hope this helps
Comments
Post a Comment