DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: ComboBox Items, Add, Remove, & Clear Generates an Error

  1. #1
    Join Date
    Aug 2004
    Orange, California

    Angry ComboBox Items, Add, Remove, & Clear Generates an Error

    I have a ComboBox on my form and I initially load it's list when the form is first opened. Once it becomes Active, anything that requires me to change the list generates the same error.

    I am using it for Disk Drives including removable USB Drives
    So these examples always fail:

    This is the Error Message:
    A first chance exception of type 'System.InvalidOperationException' occurred in System.Windows.Forms.dll

    I Can't Figure Out Why It Will Not Let Me Change The List???
    Last edited by Ron Weller; 04-11-2012 at 12:57 AM.

  2. #2
    Join Date
    Aug 2004
    Orange, California
    I have additional Information on this error.

    I used a (Try/Cath) block and this is the actual error message:
    Cross-thread operation not valid: Control 'DriveBox1' accessed from a thread other than the thread it was created on.

    Now I am trying to change the ComboBox List from an Event Handler
    You see I have a process that detects when a drive is added or removed.
    It is in a different thread; But all it does is raise an event when a drive is either added or removed.
    The Event Handler is part of the same Form as the ComboBox Control so there is no Cross-thread operation.

    Am I missing something here???
    Any Ideas would be helpful!

Similar Threads

  1. Replies: 10
    Last Post: 10-02-2009, 04:07 AM
  2. Excel question
    By garywillams in forum C++
    Replies: 1
    Last Post: 09-11-2009, 09:56 AM
  3. Replies: 2
    Last Post: 05-14-2009, 09:22 AM
  4. Replies: 0
    Last Post: 04-03-2009, 03:13 AM
  5. Re: Error handling in components called from ASP
    By James Barbetti in forum ASP.NET
    Replies: 2
    Last Post: 11-06-2001, 02:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center