S
SR
I have written a DLL to give to a customer that he can use to search a
database and bring back some results. When he calls my search function,
once the search is performed a windows form is opened up with the results.
This functionality works fine if called from a windows form but throws a
theading error if called from a console application and it definitely has
something to do with the fact that I am opening up a form because other
function calls execute fine.
This is the error:
ActiveX control '<GUID>' cannot be instantiated because the current thread
is not in a single-threaded apartment.
Is the compiler setting my form as an ActiveX control or is it having a
problem with a control on my form? The controls I have on my form are a
TreeView, TabControl, ToolStrip, WebBrowser, ToolStripStatusLabel, and a
RichTextBox.
I am calling a webserivce function for my search, which works fine, but when
I create a new form object, that's when the error occurs. I figure I
probably just need to add a parameter or another line of code to allow the
form to be created and shown, but I don't know what that line or parameter
might be!
Can anyone tell me what I need to do to solve this issue?
TIA
SR
database and bring back some results. When he calls my search function,
once the search is performed a windows form is opened up with the results.
This functionality works fine if called from a windows form but throws a
theading error if called from a console application and it definitely has
something to do with the fact that I am opening up a form because other
function calls execute fine.
This is the error:
ActiveX control '<GUID>' cannot be instantiated because the current thread
is not in a single-threaded apartment.
Is the compiler setting my form as an ActiveX control or is it having a
problem with a control on my form? The controls I have on my form are a
TreeView, TabControl, ToolStrip, WebBrowser, ToolStripStatusLabel, and a
RichTextBox.
I am calling a webserivce function for my search, which works fine, but when
I create a new form object, that's when the error occurs. I figure I
probably just need to add a parameter or another line of code to allow the
form to be created and shown, but I don't know what that line or parameter
might be!
Can anyone tell me what I need to do to solve this issue?
TIA
SR