Why i'm getting exception InvalidOperationException: Invoke or BeginInvoke cannot be called on a control until the window handle has been created ?

I have a backgroundworker1 dowork event and inside:
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
BackgroundWorker bgw = (BackgroundWorker)sender;
if (bgw.CancellationPending == true)
return;
else
this.BeginInvoke(new MethodInvoker(delegate
timer1.Stop();
Button1Code();
timer1.Start();
trackBar2.Enabled = false;
trackBar1.Enabled = false;
while (true)
bitmaps = ImagesComparison.get_images_with_clouds(b1);
for (int i = 0; i < bitmaps.Length; i++)
ConvertTo1or8Bit.BitmapToGIF(bitmaps[i], @"c:\convertedgifs\" + i.ToString("D6") + ".gif");
break;
The exception is on the BeginInvoke part.
In the last few days i was running the program many times and i didn't have this exception even once.
And now every times i'm running it i'm getting the exception.
System.InvalidOperationException was unhandled by user code
HResult=-2146233079
Message=Invoke or BeginInvoke cannot be called on a control until the window handle has been created.
Source=System.Windows.Forms
StackTrace:
at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
at System.Windows.Forms.Control.BeginInvoke(Delegate method, Object[] args)
at System.Windows.Forms.Control.BeginInvoke(Delegate method)
at mws.ScanningClouds.backgroundWorker1_DoWork(Object sender, DoWorkEventArgs e) in d:\C-Sharp\Download File\Downloading-File-Project-Version-012\Downloading File\ScanningClouds.cs:line 715
at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)
InnerException:
Line 715 is: this.BeginInvoke(new MethodInvoker(delegate

Where are you starting the background worker from?  Possibly the constructor of the form?
It would be greatly appreciated if you would mark any helpful entries as helpful and if the entry answers your question, please mark it with the Answer link.

Similar Messages

  • Is there any way that I can get back my iPhoto?  After having hard disk replaced (no backup) and the operating system has been updated to Lion (no disc) I am wondering if iPhoto can be reinstalled with my Leopard discs?

    Is there any way that I can get back my iPhoto?  After having hard disk replaced (no backup) and the operating system has been updated to Lion (no disc) I am wondering if iPhoto can be reinstalled with my Leopard discs?

    As Niel pointed out, yes.  The disk probably will look like the MBP disk (4) in this screenshot;
    OT

  • Why does my login screen when scrolling mouse over appear pixalated (has small squares wherver the mouse scrolls until the entire page has been scratched like a lotto ticket:) ?

    Why does my login screen when scrolling mouse over appear pixalated (has small squares wherver the mouse scrolls until the entire page has been scratched like a lotto ticket:) ?

    OS X Lion: Login window partially appears, cursor movement redraws screen

  • How do I get Apple to stand behind their warranty and replace my defective computer? The hard drive has been replaced twice, the track pad once, and other hardware issues. Can anyone help me so I can get Apple to replace my defective

    My computer has been a lemon. They refuse to properly diagnose, fix, and document my complaints regarding the multiple failures I have had with this computer. Also, I was told that upon my logic board being replaced back in April or May that the topic of replacing the computer altogether with one of equal equipment would be appropriate. Insofar, I have been to the store at least three times in the past month to discuss my issues with the computer that were not resolved when the hard drive was replaced in May. I was also told that the repairs on my system would be good for up to 90 days after the repair work was done and that I could buy AppleCare at the end of the 90 days in lieu of insuring a product that still had defects. I have been on the phone for what feels like hours with Apple trying to work this issue out but they are not wanting to stand behind their product nor are they willing to stand behind their warranty. The warranty expressly states that a computer can be replaced entirely if the defect is considered hardware malfunction and at the representative’s discretion. Every time I brought it in for repair it was due to hardware malfunction; however, they also said once that it was an accessory that I bought that was causing the problem which ended up not being the case after all. This is totally unacceptable. I also asked Mark from AppleCare to let me know what was repaired the second time the computer was put through a diagnostic at the Apple Store. Beachballs, Gears, excessive heat, not being taken seriously at the Apple Store, being insulted by a Mac Genius at the Apple Store, being misinformed by a Mac Genius, dealing with a misinformed Mac Genius. They replaced my iPod touch without much ado.  I was also accused by an Apple Genius of being "hyperbolic." He said this in response to my complaint of the computer melting--literally--items on my computer desk. I am either wanting a refund of my money or a replacement of my laptop. Also, I have lost an incredible amount of data on my computer due to the hard drive being replaced x 2. Not acceptable. Also, the Apple store is 1 hour from where I live. I am currently looking for employment and additionally have a legal case pending where I am the plaintiff. I have lost VERY important documents in both matters which has caused an extreme amount of stress. I do not need the added stress of an unreliable and unsafe computer. I also have been waiting for a call back from Kelly (left two voice messages with Kelly) and Mark (wrote an e-mail for which he has not responded to insofar) at Apple but have heard nothing from either one of them regarding the status of my computer. The only thing I received which was automated by the Apple Store was a confirmation that my computer was ready. I have requested documentation of what was done (basically, I am asking for the receipt) before I drive an hour to pick it up. Haven't heard anything. I brought this computer in on July 24, 2011. We are now upon August 2nd. When do I get to know what was even done on my computer? Do they really think that I am going to take back a computer into my possession only to have to bring it back shortly thereafter to address one of the many issues causing it to malfunction in the first place? I have owned 5 computers  since 1988. All of them PCs. This is my first Mac. Will it be my last?

    The only people who can possibly assist you with this is Apple Customer Relations, call your local Apple contact number and ask for Customer Relations then explain your situation clearly and politely (be firm but don't rant).
    You might want to investiage what the local laws are regarding defective goods and 'fit for use' definitions on warranties etc. Consumer Protection can be a useful tool to use or bargain with if needed ...

  • Why do i get a copy of an e-mail when i reply to all using the iPhone?

    why do i get a copy of an e-mail when i reply to all using the iPhone?  I don't want to be included on the e-mail that I am sending out.

    iOS: Unable to send or receive email
    http://support.apple.com/kb/TS3899
    Can’t Send Emails on iPad – Troubleshooting Steps
    http://ipadhelp.com/ipad-help/ipad-cant-send-emails-troubleshooting-steps/
    iPad Mail
    http://www.apple.com/support/ipad/mail/
     Cheers, Tom

  • Unable to get the composite instance for the invocation. This could be because instance has not yet been created or because the audit level for the SOA infra has been set to Off

    I am on Oracle 11.1.1.7 BPM suite on W8 64 bit. I can't launch the flow trace and get the error "Unable to get the composite instance for the invocation. This could be because instance has not yet been created or because the audit level for the SOA infra has been set to Off".  I have set the audit level to development at the soa-infra>SOA Administration> Common Properties > Audit level set to development and Capture Composite Instance State is Checked.
    Can somebody advice.
    Thanks

    Can you please confirm me the following steps...
    Log in to the EM console, Expand soa-infra (soa_server1) , go to the partition where your composite is been deployed, Click on your composite, On the right, click on the dropdown Settings and choose Composite Audit Level. you can choose to set the Audit Level for this composite. If you choose Inherit, it will take the settings to what the server is being set to. Otherwise, we can override it by choosing Off, Production, or Development.
    Make sure your setting for that composite is not Off, keep inherit or production or development.
    Thanks,
    N

  • How to get the exact time when condition records has been created?

    Hello All,
    Can anyone thorw some light on - how to find the exact time on which a particular condition record has been created?
    I have tried to get it from KONP {by inputting condition record number}, but unfortunately time is not tracked over there, but the date is tracked.
    Await your valuable inputs on the same.
    Regards,
    Hrishi

    Dear Hrishi,
    Try with this
    Go to display mode of the condition record through VK13 transaction from the condition record overview screen go to menu Environment >Changes>Click on Change report now system will take you to the Change Documents for conditions selection screen here you input proper selection data then execute now system will give the all the details here you can find the time also.
    I hope this will help you,
    Regards,
    Murali.

  • When syncing iPod the PC lost power. once power restored synced iPod but the sleeve detail has been blanked. Also when syncing a 'miss-match' message is reported on iTunes. how do I get the sleeve detail back onto iPod?

    When syncing iPod the PC lost power. once power restored synced iPod but the sleeve detail has been blanked. Also when syncing a 'miss-match' message is reported on iTunes. how do I get the sleeve detail back onto iPod?

    http://ww2.cs.fsu.edu/~rosentha/linux/2.6.26.5/docs/DocBook/libata/ch07.html#excatATAbusErr wrote:
    ATA bus error means that data corruption occurred during transmission over ATA bus (SATA or PATA). This type of errors can be indicated by
    ICRC or ABRT error as described in the section called “ATA/ATAPI device error (non-NCQ / non-CHECK CONDITION)”.
    Controller-specific error completion with error information indicating transmission error.
    On some controllers, command timeout. In this case, there may be a mechanism to determine that the timeout is due to transmission error.
    Unknown/random errors, timeouts and all sorts of weirdities.
    As described above, transmission errors can cause wide variety of symptoms ranging from device ICRC error to random device lockup, and, for many cases, there is no way to tell if an error condition is due to transmission error or not; therefore, it's necessary to employ some kind of heuristic when dealing with errors and timeouts. For example, encountering repetitive ABRT errors for known supported command is likely to indicate ATA bus error.
    Once it's determined that ATA bus errors have possibly occurred, lowering ATA bus transmission speed is one of actions which may alleviate the problem.
    I'd also add; make sure you have good backups when ATA errors are frequent

  • Is there anyway to either trade in your old Macbook Pro for a new version, or get a new power cord when the old one has been damaged?

    Well i was just wondering.. since i do have a older version of the Macbook Pro.. and the fact that the power cord has been damaged

    You can always get a price on what an Apple affiliate would give you for your old MacBook Pro by going to http://www.apple.com/recycling/gift-card/faq.html and reading the instruction for the reuse program. Or you can sell your old one on eBay (that's what I did - you'll get more for it). Apple doesn't do a simple trade-in.
    Your cheapest route is just to buy a new adapter. If you don't know which adapter to get, call Apple and they can tell you, or visit your local Apple Store. They're about $80.
    Good luck,
    Clinton

  • HT5129 I keep getting the message MobileMe has been discontinued - iPhoto willmove albums you have published to MobileMe Gallery. . .  but I have not knowingly published any photos to MobileMe.  How can I get this message to stop.  It's getting annoying.

    I keep getting the message MobileMe has been discontinued - iPhoto willmove albums you have published to MobileMe Gallery. . .  but I have not knowingly published any photos to MobileMe.  How can I get this message to stop.  It's getting annoying.
    Also, how can I remove duplicate photos in an album without doing it manually?
    Thanks!

    When the prompt pops up next time you start iPhoto select Learn more. Then click on iPhoto preferences and select the Accounts tab. Delete your MM account and the quit iPhoto. Next time you open iPhoto the problem should be eliminated.

  • Can anyone tell me how i get to speak to someone in customer service? they are retiring Forms Cental and i really need to speak to someone about the renewl of my subscription. THe live chat has been unavailable for two weeks and there is no other option t

    Can anyone tell me how i get to speak to someone in customer service? they are retiring Forms Cental and i really need to speak to someone about the renewl of my subscription. THe live chat has been unavailable for two weeks and there is no other option to get in touch with these people. Any ideas anyone?

    Hi SwarovskiUK,
    I'm sorry to hear that you've been having trouble contacting Customer Care. Live Chat is certainly available--are you not seeing the chat option on the Contact Customer Care page? Or are just not able to get through?
    In any case, I should be able to help you myself. What can I do for you?
    Best,
    Sara

  • I have photoshop elements 11 installed on my desktop pc, I want to install it on my laptop as well, I read that it can be installed on two systems, but I get a message taht the redemption code has been used by another ID, please help

    I have photoshop elements 11 installed on my desktop pc, I want to install it on my laptop as well, I read that it can be installed on two systems, but I get a message taht the redemption code has been used by another ID, please help

    A redemption code can only be redeemed once.  It is used to acquire a serial number. The serial number is what you need to activate the installed software.  If you did not keep the serial number when you first installed, you might still be able to find it in your Adobe account online if you registered the software.

  • Hi. the email application has been removed from my ipad. I don't have back up so how can I get it back?

    Hi. the email application has been removed from my ipad. I don't have back up so how can I get it back?

    It is not possible to remove the Mail app (or any other of the bundled apps) from the iPad. It's probably been moved to another Home screen or inadvertently placed in a folder. If you can't find it, you can reset the Home screens in the General -> Reset preferences.
    Regards.

  • I am running with Firefox version 3.5.7. I am trying to update to a more recent version. So far, the update has been running for 4 hours. For most of the time it has been downloading versoin 3.6.18. Why am I hanging trying toi update?

    I have an old version of Firefox - Version 3.5.7.
    I am trying to update to the current version. As part of the update, the system is first loading all of the intermediate versions.
    I started the update 4 hours ago. It is still running. Most of the time, it has been downloading version 3.6.18. I am letting it run.
    Is there any other way to get the most recent version?

    Thank you. That is basically what I did. I gave up on the update and downloaded a fresh version of Firefox.

  • Has downloaded I3D through App store. It has been written FREE. From the account it has been written off 2.99$ WHY??

    Has downloaded I3D through App store. It has been written FREE. From the account it has been written off 2.99$ WHY??

    i recieved the same email with the same game and it also stated the purchase was from canada i have revieved a few other as well and am concerned i have changed my password a few times now but i still revcieve emails and am very worried. i recieved the email near the date this question had been put up
    however i do not know how they are downloading apps as my credit card details need verification when i download anything , any help would be much appreciated.

Maybe you are looking for

  • How can I convert a Pages document into PDF or RTF?

    I have been asked to send a Pages document to PC users in RTF or PDF format.  How can I get my Pages document to convert into other formats for PC people? Is that what the export feature is supposed to do?  I just don't know how to sent my document v

  • PSE 12 catalog backup fails repeatedly??

    I have tried numerous times to back up the catalog and photos to an external hard drive.  All goes well until the last minute and then a message appears:  "Error encountered while writing files C:\Program Data . . . ."

  • Block IP Address in J2SE

    Hi, im try to make aplication when it can block ip address to access my computer. any body know how to block ip address using java??

  • Why does my Mac book keep freezing? Help!

    Why does my Mac book pro keep freezing at the login screen making it impossible for me to log into my laptop?? A multi color spinning disc keeps appearing even before I am able to type in my entire password. This keeps on happening even after a hard

  • SQL to retrieve faulted instances and fault reason code for SOA composites

    Hi, Could you please provide me some SQL which will retrieve composite faults with details on a particular period? Thanks in advance.