Re: Can’t copy to clipboard
From: Jeff Gaines (jeff_at_jgaines.co.uk)
Date: 02/20/04
- Next message: Dmitriy Lapshin [C# / .NET MVP]: "Re: TargetInvocationException makes no sense"
- Previous message: Paul: "CreateWindowStation"
- In reply to: Dennis: "Can’t copy to clipboard"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 20 Feb 2004 10:02:11 +0000
On Thu, 19 Feb 2004 07:56:05 -0800, Dennis
<anonymous@discussions.microsoft.com> wrote:
>I get the following exception when I try to put a string in the clipboard:
>
>Unhandled Exception: System.Runtime.InteropServices.ExternalException: The requested clipboard operation failed.
> at System.Windows.Forms.Clipboard.SetDataObject(Object data, Boolean copy)
>
>Could anyone tell me what’s wrong with this program? Thanks
>
>using System.Windows.Forms;
>
>public class Test
>{
> public static void Main()
> {
> Clipboard.SetDataObject("test", true);
> }
>}
Dennis
This works for me:
private void btnCopyAddress_Click(object sender, System.EventArgs e)
{
string strAddress = txtName.Text + '\n' + rtfAddress.Text;
Clipboard.SetDataObject(strAddress);
}
But it's really no different to what you are doing.
Is your program capturing the Clipboard elsewhere and not releasing
it?
-- Jeff Gaines Damerham Hampshire UK
- Next message: Dmitriy Lapshin [C# / .NET MVP]: "Re: TargetInvocationException makes no sense"
- Previous message: Paul: "CreateWindowStation"
- In reply to: Dennis: "Can’t copy to clipboard"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|