iam trying to paste the data gathered from the clipboard in a textbox (C#)
In this case i copy something into the clipboard
Clipboard.SetText("Hello, clipboard");
How can i do that at the exact moment that clipboard has something,(or when the users does a ctrl+c) perform a copy event into a textbox?
i have tried with this code;My textbox is tbData:
private void tbData_TextChanged(object sender, EventArgs e)
{
if (Clipboard.ContainsText(TextDataFormat.Text))
{
tbData.Text = Clipboard.GetText();
Clipboard.Clear();
}
}
but i get this exception:
Requested Clipboard operation did not succeed