473,385 Members | 1,782 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Difference BackgroundWorker / Threads

Can anybody tell me, whats the main difference between a BackgroundWorker and
a Thread? What are the advantages/disadvanteges? When use a BackgroundWorker,
when a Thread?
Apr 29 '06 #1
4 2534
DHarry <DH****@discussions.microsoft.com> wrote:
Can anybody tell me, whats the main difference between a BackgroundWorker and
a Thread? What are the advantages/disadvanteges? When use a BackgroundWorker,
when a Thread?


BackgroundWorker operates in a different thread already. It just
provides a convenient way of reporting progress with all the
marshalling back to the UI thread being done for you.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Apr 29 '06 #2
The nice thing about a BackgroundWorker component is that it handles all the
marshalling for you, with a consistent and fairly simple object model. In a
Windows Forms app, this can be a real time-saver for the developer.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
DHarry <DH****@discussions.microsoft.com> wrote:
Can anybody tell me, whats the main difference between a BackgroundWorker
and
a Thread? What are the advantages/disadvanteges? When use a
BackgroundWorker,
when a Thread?


BackgroundWorker operates in a different thread already. It just
provides a convenient way of reporting progress with all the
marshalling back to the UI thread being done for you.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

Apr 30 '06 #3
I see... is it right that a BackgroundWorker is a special kind of Thread with
additional methods?
Apr 30 '06 #4
Not exactly. A BackgroundWorker is a component, which encapsulates the
functionality to marshall between an asynchronous Thread and the Windows
Form STA Thread.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.

"DHarry" <DH****@discussions.microsoft.com> wrote in message
news:C4**********************************@microsof t.com...
I see... is it right that a BackgroundWorker is a special kind of Thread
with
additional methods?

Apr 30 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Sebastian Crewe | last post by:
Greetings, I was much encouraged to see the new BackgroundWorker class in .NET v2. On the face of it, much easier to use than the various delegates and events of yore, though I imagine the same...
5
by: Rob R. Ainscough | last post by:
I'm using a BackgroundWorker to perform a file download from an ftp site. Per good code design practices where I separate my UI code from my core logic code (in this case my Download file method in...
9
by: =?Utf-8?B?VE9NX1Bhc2FkZW5h?= | last post by:
Hello, In my ASP.Net app I'm launching a BackgroundWorker thread in my Page_Load function. In that thread I'm attempting to connect to a SQL server using this connection string "Initial...
8
by: =?Utf-8?B?cmFuZHkxMjAw?= | last post by:
I have an application with several BackgroundWorker threads. I hoped I'd be able to just type backgroundworker1.Name = "bw1"; but I don't see a name property. Any thoughts on how to name a...
9
by: RvGrah | last post by:
I'm completely new to using background threading, though I have downloaded and run through several samples and understood how they worked. My question is: I have an app whose primary form...
3
by: Piotrekk | last post by:
I have a question. One day i have been working with threads. Thread had 'while' loop that checked locked value telling the thread when application was closing ( in Dispose method i set locked...
3
by: Coaster | last post by:
I want to create a "thread manager" class to manage an array of backgroundworkers. I'd like this thread manager class to live in a class library and I wasn't sure if it was possible to make the...
2
by: =?Utf-8?B?SGFycnkgS2Vjaw==?= | last post by:
I have introduced a component to my solution that is throwing an exception about needing to be run in single threaded apartment mode. This component is created in an async call by a...
1
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Hi misters, Is it possible "kill" the thread of Backgroundworker ? In my Dowork event, I have NOT While for do e.Cancel = true, only have a call to external COM. If I want cancel, calling...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.