I want to copy selected columns to the DataGridView clipboard and paste them in Notepad or Microsoft Word. What is the best way to achieve this?
Thank you ..
I use a copy menu item. If you want to use Ctrl + C, you have to apply the keyboard event here. My code is:
Private Zero copyToolStripMenuItem_Click (Object Sender, EventArgs e) {foreach (tabControl1.SelectedTab. Controls in control myControl) {if} {DataGridView tempdgv = (myControl is DataGridView) (DataGridView) myControl; DataObject dataObj = tempdgv.GetClipboardContent (); Try {Clipboard.SetDataObject (dataObj, true); } Hold (Exception Pre) {// Something} Finally {if (selectAllToolStripMenuItem.Checked) {selectAllToolStripMenuItem_Click (This, EventArgs.Empty); }}}}}
No comments:
Post a Comment