Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

C# Help

Name: !WRKzxSNkh6 2011-10-22 0:34

Having an issue using
>http://msdn.microsoft.com/en-us/library/ydby206k.aspx
and not sure how to incorporate this fix
>http://msdn.microsoft.com/en-us/library/system.stathreadattribute.aspx#Y0

Here's a post to my source code
>http://pastebin.com/10zj97RQ

I'm trying to get it to copy the final result into the user's clipboard, but I keep hitting the ThreadStateException

Name: Anonymous 2011-10-22 0:52

Lawdy.
You couldn't have gone with a map or something instead of a 10000000000000-line switch statement?

It says to add STAThreadAttribute to your application's "Main" method...  why am I helping you?

Name: Anonymous 2011-10-22 0:56

The program is completely functional, I'm having an issue getting one line to work, that being line 248

Clipboard.SetText(finalText);

due to said exception above

Name: Anonymous 2011-10-22 1:05

>>3
Yes, idiot, and the documentation that you yourself provided a link to says that you need to add STAThreadAttribute to your application's Main method.


Exception               Condition

ExternalException         The Clipboard could not be cleared. This typically occurs when the Clipboard is being used by another process.
ThreadStateException      The current thread is not in single-threaded apartment (STA) mode. Add the STAThreadAttribute to your application's Main method.
ArgumentNullException     text is Nothing or Empty.

Name: Anonymous 2011-10-22 1:07

I don't know HOW to add the attribute. I should have clarified that better.

Name: Anonymous 2011-10-22 1:14

>>5
Well fuck if I know, either, but the documentation says you just paste this:


[ComVisibleAttribute(true)]
[AttributeUsageAttribute(AttributeTargets.Method)]
public sealed class STAThreadAttribute : Attribute


into your application's static void main() method.  You pasted it into your namespace.

Name: Anonymous 2011-10-22 1:18

>>6
That didn't do anything but cause errors. Generated 20 errors compared to the 1 I had before ;_;

Don't change these.
Name: Email:
Entire Thread Thread List