So we received this error recently. We have a fairly complex multi-threaded FAT client application that uses some of the new functionality of the Visual Studio 2005 ComboBox, namely the AutoCompleteMode. The problem that we had occurred when we would load the ComboBox from a handler that was triggered from another form. (Picture form 1 loading form 2 through events.)Interestingly enough, the ONLY control to have this error was the ComboBox, and the ONLY time it generated the error is when AutoCompleteMode was set to true.
The fix was simple enough:
Thread.CurrentThread.SetApartmentState(ApartmentState.STA);
We've been running about 5 days with that line of code added just before the AutoCompleteMode, and things have been working fine. I'm not sure what other side effects we'll see.
What bothers me the most is what little information I could find on this error. I found many posts all over where people were able to produce the error, but nowhere that the fix was spelled out. That's one of the few fixes that we had to find without support documentation.

1 comment:
Thx, dude!
Post a Comment