I am trying to copy the selected treeview node to the clip board so I can paste it in notepad. Here is my code but it doesn\'t work.
TreeNode selNode = (
Notepad doesn't know anything about the Winforms TreeNode class. Use Clipboard.SetText() instead:
private void treeView1_KeyDown(object sender, KeyEventArgs e) {
if (e.KeyData == (Keys.Control | Keys.C)) {
if (treeView1.SelectedNode != null) {
Clipboard.SetText(treeView1.SelectedNode.Text);
}
e.SuppressKeyPress = true;
}
}