Exemplo n.º 1
0
        private void mnuCopyToClipboard_Click(object sender, System.EventArgs e)
        {
            DGrid.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText;

            if (DGrid.GetCellCount(DataGridViewElementStates.Selected) > 0)
            {
                try
                {
                    // Add the selection to the clipboard.
                    Clipboard.SetDataObject(DGrid.GetClipboardContent());

                    // Replace the text box contents with the clipboard text.
                    //Me.TextBox1.Text = Clipboard.GetText()
                    MessageBox.Show("Successfull!!", MyModules.strApptitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch
                {
                    MessageBox.Show("The Clipboard could not be accessed. Please try again.");
                }
            }
        }