C# BackgroundWorker Not Working?

You've hooked up the callbacks but not actually called RunWorkerAsync to start it going.

You've hooked up the callbacks but not actually called RunWorkerAsync to start it going. As an aside, you're also calling UI elements in the DoWork method which will fail. You need to use BeginInvoke to mashal the updates back to the UI thread or do the updates in the RunWorkerComplete method (which is run on the UI thread automatically).

MessageBox. Show(""); This will cause a big problem. You can't call UI from a non UI thread.

I'm surprised that it hasn't raised an exception. At best it's probably causing your thread to abort and not do anything. The theList looks like a UI element as well.

If you are adding to control then you need to pass the data via an event to the UI so you can update it there. You also have: Alert(en. Message, "Retry", Error, true, Color.

FromArgb(249, 87, 55) ); In your exception handler. Again this looks like you are trying to call UI elements.

It wasn't working even before I put the MessageBox(""); there and "thelist" is a ListView control. I've always been told to use Background worker instead of Thead t = new Thread(()=>{}; if I want to do UI work. How can I make it do UI work?

– anon271334 Mar 19 at 19:15 1 @J.T.S. I just spotted theList too. You need to pass the data to the UI via an event. There are other questions on this on Stack Overflow.

I've even answered a few. – ChrisF Mar 19 at 19:17 1 If he wants to show the message box inside the non UI thread he will have to Invoke it. – Nick Mar 19 at 19:21.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions