ampflp
asked on
C# Clipboard - need data persistence after application is closed
I am writing a simple c# (VS2005) application to put data on a clipboard from a listbox. It is all working correctly - I can paste the data from the clipboard into wordpad, etc.
The problem comes when I close my C# application. The data disappears from the clipboard. I would like it to be persistent. I assumed since it was on the system clipboard, it would be available until something else was put on the clipboard. But - it is no longer there.
Is there any way to keep it?
The problem comes when I close my C# application. The data disappears from the clipboard. I would like it to be persistent. I assumed since it was on the system clipboard, it would be available until something else was put on the clipboard. But - it is no longer there.
Is there any way to keep it?
Agreed...post your code as data I place on the clipboard is still there when my app closes.
ASKER
Here's the code -
private void btnCopyAll_Click(object sender, System.EventArgs e)
{
StringBuilder sb = new StringBuilder();
foreach (String str1 in msgList)
{
sb.Append(str1);
sb.Append("\r\n");
}
String outString = sb.ToString();
Clipboard.SetDataObject(outString);
}
That should work...do you have any third-party clipboard managers installed or anything like that on your system?
use;
Clipboard.SetText
http://msdn.microsoft.com/en-us/library/tbfb3z56.aspx
why convert to string while there is a direct way of using a clipboard string
OR
find;
Clipboard.Clear
It's impossible that the clipboard is gone without clearing it.
OR
issue a;
Clipboard.Clear, to clear the clipboard first before another one
Clipboard.SetText
http://msdn.microsoft.com/en-us/library/tbfb3z56.aspx
why convert to string while there is a direct way of using a clipboard string
OR
find;
Clipboard.Clear
It's impossible that the clipboard is gone without clearing it.
OR
issue a;
Clipboard.Clear, to clear the clipboard first before another one
ASKER
oh - Office Clipboard is in the taskbar icon list - could that be interfering somehow? (I am new to this work computer, don't know if there's something else hiding out)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
good catch
ASKER
I missed that one - thank you so much. -
http://www.radsoftware.com.au/articles/clipboardmonitor.aspx
But
at least paste your code snippet?