Start background thread when a UI button is clicked, and Update UI button from background thread

I was asked these questions during a technical interview:

1) When the user clicks on a button on the form and that invokes a lot
of heavy-duty calculations, what would you do?

My answer:

I would use "BeginInvoke" to start a background worker thread to do
the heavy-duty calculations, in order to avoid blocking the main UI
thread.

Then he asked, "What does 'BeginInvoke' do"? I said it was a .NET
pattern to start a background thread from a UI thread. Did I get it
right?

2) Why can't you simply update a button on the UI thread from a
background thread?

My answer:

If I update a button on the UI thread while the user is clicking on
the button on the UI thread, that would result in memory corruption.
Did I get this one right?

0
Curious
3/31/2010 9:01:48 PM
dotnet.general 306 articles. 0 followers. Follow

0 Replies
1398 Views

Similar Articles

[PageSpeed] 17

Reply:

Similar Artilces:

Re: Outlook 2007 create background
I played around with this further. You can still use any HTML editor to = create stationery and place it in the user's Stationery folder. You can = also use FrontPage 2003 to create new themes with background images. = Details at = http://turtleflock-ol2007.spaces.live.com/blog/cns!C1013F1F9A99E3D8!230.e= ntry --=20 Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for=20 Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx =...

saving the spreed sheet by clicking on a cell?
I have made an Excel spreed sheet for my students that they need to fill out with some data. They also enter their ID number in a specific cell. I want to create a cell (let call it "Save" button) so that when the students click on it, it automatically save the file with their ID number which was entered in the specific cell in my directory. Thanks for your help in advance. Dori Hi! You can simply click on the "Save" icon on the Standard toolbar (if you display that toolbar). It looks like a floppy disk. Biff "DORI" <DORI@discussions.microsoft.com> ...

Updating a field property
This is probably simple, but I'm stuck. On a form..... ......Fields "A", "B", and "C" all have a green backcolor ......A value is entered into field "A" ......Field "B" is updated via a DLookup ......If field "B" contains a certain string, I would like to set the Backcolor of field "C" to white (16777215) I set the backcolor of field "B" to white using Conditional Formatting, but that won't allow me to use multiple fields (to check the value of a different field than the one selected). I've tri...

Where the send later button?
Hello, I am new to Outlook and I am regular user of OE mainly. Due to heavy volume of emails I have to shift to O2003 which is on the PC and not being used. I cannot find the 'send later' button on the software! There is only 'send'. I am on a dial up connection and thus how can I type emails and then press 'send later' and then send all emails in one go. How can this be done? Thanks for your replies. When sending when not connected the message will be queued in the Outbox folder. To set an actual date press the Options button when composing. -- Robert Sparnaai...

WMC says UI unexpectedly launched and then closes
Hi All, I was previously able to listen to music via my X-box Extender but now when I try to connect to WMC it says an application launched UI unexpectedly and the connection is lost. I can't seem to resolve this issue - can anyone please help. The extender shows up on my network until this message is shown then disappears yet all connections are fine. -- raw68 ------------------------------------------------------------------------ raw68's Profile: http://forums.techarena.in/members/174452.htm View this thread: http://forums.techarena.in/mediacenter/1293597.htm ht...

Starting up on start-up help!
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel Hello all, <br><br>I'm new here so Hello. I just have a question to see if anyone can help here. I just recently bought a new MacBook Pro, and I got the Microsoft Office for it too. Well, I recently noticed that on start up, entourages My Day keeps opening up. Well when I right click the menu, I check off the box where it says to start on login. <br><br>Well here is the problem. Everytime I uncheck it, it still keeps opening up on start up. <br><br>Anyone know why?...

Check out this security update from the Microsoft Corp.
--raadzbbqithpnp Content-Type: multipart/related; boundary="pmxpzueoeva"; type="multipart/alternative" --pmxpzueoeva Content-Type: multipart/alternative; boundary="vaklcirho" --vaklcirho Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Microsoft Consumer this is the latest version of security update, the "November 2003, Cumulative Patch" update which eliminates all known security vulnerabilities affecting MS Internet Explorer, MS Outlook and MS Outlook Express as well as three newly discovered vulnerabilities. Install now to prot...

Thread and send or receive data time managemennt
Hi all, I need to setup a multi-threaded VC++ application which is hand-shake with VB application. Both of them are sending data to each other. VB basically will send data to one of VC++ thread to do some process and send another to invoke another thread. ALL is working well and fine if the sending of data is within seconds. My problem is if the sending data speed between 2 application is too fast let say 20miliseconds, it's Not working. VC++ appplication seems do not receive anything from client. Please advise Without seeing some sketch of the code it is impossible to tell what is go...

What tables are updated in PA when contract's status changes
Hello, Could someone let me know what tables are updated in Project Accounting when I change a contract’s status from “Open” to “Completed”. Is there a way also to to do a SQL trace for this purpose. -- Thank you, ...

Changing Componet Background Colours
Hello, I was wondering how I could go about changing the background colours for the various Visual C++ controls such as the listboxes,edit boxes, etc. I am using Visual C++ .NET 2003 and this is a MFC application. Thanks in advance. Sincerely, James Simpson Straightway Technologies http://www.straightwaytech.com Typically you will need to do this in OnCtlColor, but thats not entirely true. Some controls require that you owner draw them. Views on other hand, will force you to use OnEraseBkgnd. Fortunately, codeguru/codeproject has samples of all these controls and is your best bet for MF...

Deleting "Suggested Sites" Button
How can I permanently delete the "Suggested Sites" button from the IE8 toolbar? Frequently the button returns to the favorites bar even though I previously delete it. -- Jim Benet Hi Jim, Try, Display the Favorites bar (Ctrl+Shift+I) and pin it to the side (for the time being). Drag and Drop the Suggested Sites Web slice from the 'Favorites Bar' to the Favorites Pane to move it from the Favorites Bar. On the Favorites Pane select the Suggest Sites link you just dropped there and right click to display the context menu. Select Delete. You will s...

Help with adding Background music to email using Outlook 2003
Can anybody tell me how to add background music to emails using Outlook 2003. I know you can do it in Outlook Express, but is there a way to do it in Outlook? Thanks please email me thanks staple502@yahoo.com Actually it might be good to post the answer here so that everybody can see.. thanks again. "nk" <staple502@yahoo.com> wrote in message news:c1deqv$3eb$1@terabinaries.xmission.com... > Can anybody tell me how to add background music to emails using Outlook > 2003. I know you can do it in Outlook Express, but is there a way to do it > in Outlook? Thanks ...

Need advice to start off a project
Hello! I have never really used Excel much but I have had an idea which could make some of the work I do a lot easier. I know Excel is powerful but I don't know the best way to approach it so can anyone out there help me? I make visits to places and record what kind of visit it was on a spreadsheet with the values in each cell being the date. At the bottom there is a summary box which shows, on each date, how many visits I made of each type. At the moment this is done manually but I am sure it can be done automatically only how? On a different sheet I would then like to have a summary of...

Exchange Services Do not Start After a Restart #2
I have a SBS 2003 Running and for some reason some of my Exchange Service do not start after a restart. System Attendand tries to start shuts down unexpectedly. I can go to services right after logging in and start the services and they start with no problem. Right before the error that service did not start, I get this warning: "A service process other than the one launched by the Service Control Manager connected when starting the Microsoft Exchange System Attendant service. The Service Control Manager launched process 2448 and process 3688 connected instead. Note that if this se...

Word 2007 and Microsoft Updates
There was an automatic update applied to my Vista 64 bit system, probably on 2/10 or 2/11. Word stopped working. If I wanted a word count it stopped responding, if I wanted to change the list for a Word merge operation it stopped responding, if I tried to open a document it would stop responding. I have restored my system to 2/9 and everything worked again. Last night Vista updated and Word was broken again. I've restored to 2/9 but I can't find any other discussion about the problems the update created. Any other users having the same problem? I have turned off a...

Form background
Hi. I'm using VC++ 7.0 do develope my MFC dialog based application. Is there some way how to set background for my form? Just like property. Drawing in runtime is unwanted. There's no problem to set background in C# project, but in MFC project I din't find any way. And the second minor question: Does MFC prject in VS.NET support the same MFC libraries just like VS 6.0 or I should provide with my program newer version of MFC? Thanks. -- German Koninin --------------------------------------------------------------------- For every complex problem, there's solution that is si...

Cannot start Outlook 2002
My computer is usualy connected to an MS Exchange server at work. However I'd like to use Outlook at home with another e-mail account. When I try to start Outlook I get an error message : Cannot connect to exchange server. So I click work offline. Then, get another error message: Cannot start Outlook. Could not open information store. The the program quits. Anyone know a work around? Thanks. Create a new profile for your home account. Then set Outlook to prompt for profile. Select your home profile and Outlook will not try to connect to Exchange. --� Milly Staples [MVP - Outlook...

Submit button to email
Hello everyone, I am trying to code a submit button on my form that will export the data entered and then send it in email format. Any suggestions would help. Create a report based on the current record and then use SendObject to send the e-mail. -- Hope this helps, Daniel P "shwinn" wrote: > Hello everyone, > > I am trying to code a submit button on my form that will export the data > entered and then send it in email format. Any suggestions would help. ...

Macro or Lookup? Not sure where to start.
I have created two worksheets: 1) Auction Items Item# Table# Location# ItemDescription WinBid are the headers of the data. 2) Bidders Bidder# FirstName LastName I would like to be able to create a macro or something that will allow me to enter the item#, bidder# and winning bid price and have a sheet filled with. ie. Item# 2 (Handcrafted Table) Bidder# 12 (John Doe) Winning Bid $250 Can excel pull from two sheets and created another sheet with all the final details? I am a little new to excel (version 2000) it is the only tool/application available to us at this time. If anyone can poi...

Remove Options under Account Actions Button
Can anyone tell me how I can hide specific items under the Account > (Actions Button) for example remove "Delete Account" from the drop down menu? Hi, Remove the rights of deletion of Account from the roles and "Delete Account" button will disappear. -- uMar Khan :: MS CRM MVP CRM Freelance Consultant Email :: imumar at gmail dot com Blog :: http://umarkhan.wordpress.com MVP :: https://mvp.support.microsoft.com/default.aspx/profile/umar.khan "Sixty4" wrote: > Can anyone tell me how I can hide specific items under the Account > > (Actions Button)...

Outlook starting problem
"Cannot start Microsoft Outlook. A dialog box is open. Close it and try again." ...

Running CHKDSK at start up
Is there a way to run chkdsk f/r on all five drives on one PC at start up? PC runs Windows XP Pro SP3. This way all drives would be checked and errors fixed, if necessary, in one go, at start up on this machine. We intend to do this on this heavily used PC from time to time - we do not need the desired chkdsk functionality to kick in at every boot! Regards and TIA. Avatar -------- "Avatar" <Avatar@re.birth> wrote in message news:hrb4n2$53i$1@news.eternal-september.org... > Is there a way to run chkdsk f/r on all five drives on one PC at start up? ...

How do I add consecutive numbers but start over at a break in the.
add consecutive numbers but start over at a break in them. I'm trying to calculate consecutive days of attendance. ...

Starting a new paragraph within a cell
How do you create a line break within a cell? For example, if wanting to list 2 or more items it looks better if each one is printed under the other as a list. Or in a comment column when needing to start a new paragraph, again within the cell. Hi. You can press Alt + Enter to create a line break within a cell. Kath firman wrote: > How do you create a line break within a cell? For example, if wanting to list > 2 or more items it looks better if each one is printed under the other as a > list. Or in a comment column when needing to start a new paragraph, again > within th...

Can't Start Any Program
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel It has been two weeks since I can open an Office Program. Please HEEELP! This is my word error report: Microsoft Error Reporting log version: 2.0 Error Signature: Exception: EXC_BAD_ACCESS Date/Time: 2009-09-09 19:04:02 -0400 Application Name: Microsoft Word Application Bundle ID: com.microsoft.Word Application Signature: MSWD Application Version: 12.2.0.090605 Crashed Module Name: CoreFoundation Crashed Module Version: unknown Crashed Module Offset: 0x00075354 Blame Module Name: CoreFoundation Blame Module Version: unk...