Solved

Copy Text to Clipboard

Posted on 2013-01-15
5
518 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
  • 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 300 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

932 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now