Jump to content
Xtreme .Net Talk

Recommended Posts

  • *Experts*
Posted

What context? What's the code you're running (and the other code that initiates it)?

 

-Nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted

That's not easy to answer....

I'm developing an AddIn for Word2000

There everything works fine.

 

Additional to that I have a simple EXE. This EXE opens word and then uses my AddIn. Two of my forms causes the described error. Therefore I'm not sure, if any code would help. My guess is, that it may be caused by the toolbar which is on both forms. I have other forms within my AddIn which have no toolbar and those forms all work.

 

Heike

Posted

Maybe this can help anyone to give me a hint...

 

The original message is:

************** Exception Text **************

System.InvalidOperationException: DragDrop registration failed. ---> System.Threading.ThreadStateException: The current thread must set to Single Thread Apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it.

  • *Experts*
Posted

By context, I mean what is it you're developing? Is this something that supports DragDrop (by your original message header) or is it something to do with OLE Automation? And when does your error occur? As soon as your object loads or some time later, during an event or method call?

 

-Nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted

It seems like I solved the problem a few minutes ago.

I set the property AllowDrop of my toolbar to FALSE and until now the error hasn't occured any more...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...