?
Solved

Copy Text to Clipboard

Posted on 2013-01-15
5
Medium Priority
?
525 Views
Last Modified: 2013-01-15
What do I need to change?

    protected void cmdGetResearchList_Click(object sender, EventArgs e)
    // Builds the symbol list for nasdaq.com
    {
        string strSymbolName1 = "";
        foreach (GridViewRow row in grdWatchList.Rows)
        {
            strSymbolName1 += row.Cells[2].Text + ",";
        }
        txtResearchList.Text = strSymbolName1;
        Clipboard.SetText(txtResearchList.Text);   // Error here

    }

Compiles but errors.

Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it.

What should I change?

Thanks,
0
Comment
Question by:Dovberman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 38779780
I'm sorry, but you're trying to paste text to the clipboard from a web page?
0
 

Author Comment

by:Dovberman
ID: 38780061
I am trying to paste text to the clipboard from my own web page.

This code is in my aspx.cs file.

The string is "UNTD,SAIA,HUBG,STR,ARTNA,NWS,AGM,CBU,VLY,"
0
 
LVL 34

Accepted Solution

by:
Paul MacDonald earned 900 total points
ID: 38780123
Would it help to just save the text to a file?  I'm not sure you can paste to the clipboard from a web page.
0
 

Author Comment

by:Dovberman
ID: 38781443
There seems to be no resolution. I will copy the text to a popup window.
0
 

Author Closing Comment

by:Dovberman
ID: 38781446
Thank you.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question