UL-Tomten wrote:
Still, "The Clipboard class can only be used in threads set to single
thread apartment (STA) mode. To use this class, ensure that your Main
method is marked with the STAThreadAttribute attribute" according to
the System.Windows.Forms.Clipboard docs.
That's System.Windows.Forms.Clipboard. The OP doesn't specify, but
there is also a System.Windows.Clipboard, which does not have the same
limitation. It is new to .NET 3.0 however.
Even using the Forms.Clipboard, I don't see that being
STAThreadAttribute is necessarily a problem. I would be more concerned
about some of the other limitations of that class. Even if I had a
Form-based application, if using the new System.Windows.Clipboard class
was an option, I'd try that first.
Looking at the Clipboard
class, it uses old OLE code from hell, so I can't see it working in
non-form .NET environments.
You never know until you try. But the OP didn't say that's the class
he's trying to use. For that matter, the OP wasn't very specific about
what issue he's actually asking about. I guess we'll have to wait for a
clarification.
Pete