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? Thank

using System.Windows.Forms

public class Tes

public static void Main(

Clipboard.SetDataObject("test", true)

Re: Can?t copy to clipboard by Jeff

Jeff
Fri Feb 20 04:02:11 CST 2004

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