示例#1
0
        private void pasteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                //DataGridViewCell cell = this.dataGridView1.CurrentCell;

                DataGridSelection sel = new DataGridSelection(this.dataGridView1);

                sel.PasteWithPrimaryKey(ClipBoardUtility.GetDataTableFromClipboard(), m_rating_id);
                //DataGridViewUtility u = new DataGridViewUtility(this.dataGrid1);
                //u.PasteFromClipboard();
                //  DrawGraph();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        public void PasteFromClipBoard()
        {
            try
            {
                DataGridViewCell cell = this.dataGrid1.CurrentCell;

                if (cell != null)
                {
                    if (cell.ColumnIndex == 0)
                    {
                        MessageBox.Show("Pasting in the Date column is not supported");
                        return;
                    }
                }
                DataGridSelection sel = new DataGridSelection(this.dataGrid1);
                sel.Paste(ClipBoardUtility.GetDataTableFromClipboard());
                //DataGridViewUtility u = new DataGridViewUtility(this.dataGrid1);
                //u.PasteFromClipboard();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }