Can anybody tell me, whats the main difference between a BackgroundWorke r and
a Thread? What are the advantages/disadvanteges? When use a BackgroundWorke r,
when a Thread? 4 2557
DHarry <DH****@discuss ions.microsoft. com> wrote: Can anybody tell me, whats the main difference between a BackgroundWorke r and a Thread? What are the advantages/disadvanteges? When use a BackgroundWorke r, when a Thread?
BackgroundWorke r 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.co m> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
The nice thing about a BackgroundWorke r 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.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com... DHarry <DH****@discuss ions.microsoft. com> wrote: Can anybody tell me, whats the main difference between a BackgroundWorke r and a Thread? What are the advantages/disadvanteges? When use a BackgroundWorke r, when a Thread?
BackgroundWorke r 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.co m> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet If replying to the group, please do not mail me too
I see... is it right that a BackgroundWorke r is a special kind of Thread with
additional methods?
Not exactly. A BackgroundWorke r 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****@discuss ions.microsoft. com> wrote in message
news:C4******** *************** ***********@mic rosoft.com... I see... is it right that a BackgroundWorke r is a special kind of Thread with additional methods? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 base classes are being invoked.
Anyway, I have given it a try with a VB.NET application that generates
charts. Since there are some 3,000 charts to do, I wanted to put the chart
generation on a separate thread. Works fine inasmuch as the...
|
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 my FileIO class) I've
established Public Event in my core logic classes along with RaiseEvents
(that will updated a progress bar on the UI side). This all works great
when I'm NOT using Threading (BackgroundWorker), however, as soon as I...
|
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 Catalog=MyDB;Data Source=MyServer;Integrated
Security=True;".
When I use the same connection string in my main thread of execution it
works fine. However when I use that connection string in the newly created
thread I get this exception: "Login...
|
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 backgroundworker thread?
Thanks,
Randy
|
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 will almost always lead to the user
opening a certain child window that's fairly resource intensive to
load. Is it possible to load this form in a backgroundworker and then
use the Show method and hide method as necessary? Anyone know of
| |
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 object's value to 'true'). If i
didn't have the locked object the thread was present in taskmanager
even when application has been already gone.
My question is:
|
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 thread manager a
subclass of the backgroundworker so that I could start it up and still do
other things on the client. Essentially a thread that spins off new threads.
Am I going to hit any limitations here?
thank you
|
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 BackgroundWorker object, which seems to be on a
MTA thread. Is there a way for me to get the BackgroundWorker thread to run
in STA mode, or do I have to remove the BackgroundWorker and hand spin my own
async call?
|
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 CancelAsync, not cancels the call to COM.
How I can do it , please ? Any suggestions will be very appreciated.
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |