Dovberman
asked on
Copy Text to Clipboard
What do I need to change?
protected void cmdGetResearchList_Click(o bject 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(txtResea rchList.Te xt); // 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,
protected void cmdGetResearchList_Click(o
// 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(txtResea
}
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,
I'm sorry, but you're trying to paste text to the clipboard from a web page?
ASKER
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,CB U,VLY,"
This code is in my aspx.cs file.
The string is "UNTD,SAIA,HUBG,STR,ARTNA,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
There seems to be no resolution. I will copy the text to a popup window.
ASKER
Thank you.