copying row in datagridview
-
I have a stupid question like this How do I copy a row and paste it into a new row at run time? I know I can use the getClipboardContent method and work with this content. It seems to be a bad way, even unexpected result. Help me solve my problem . Thanks in advance
It seem to be a solution or an answer.
-
I have a stupid question like this How do I copy a row and paste it into a new row at run time? I know I can use the getClipboardContent method and work with this content. It seems to be a bad way, even unexpected result. Help me solve my problem . Thanks in advance
It seem to be a solution or an answer.
The ClipboardContent Method is ok. pls put your code we will help you in this regard.
Regards, Satips.
-
I have a stupid question like this How do I copy a row and paste it into a new row at run time? I know I can use the getClipboardContent method and work with this content. It seems to be a bad way, even unexpected result. Help me solve my problem . Thanks in advance
It seem to be a solution or an answer.
My code is here private void copyToolStripMenuItem_Click(object sender, EventArgs e) { DataObject obj = dataGridView1.GetClipboardContent(); str = obj.GetText(TextDataFormat.CommaSeparatedValue).Substring(1).Split(','); } private void pasteToolStripMenuItem_Click(object sender, EventArgs e) { try { DataGridViewRow dgvRow = dataGridView1.Rows[0]; for (int i = 0; i < str.GetLength(0); i++) dgvRow.Cells[i].Value = str[i]; dataGridView1.Rows.Add(dgvRow); } catch (Exception ex) { } } But it throws an exception "Rows cannot be programmatically added to the DataGridView's rows collection when the control is data-bound" I am very confused. Kindly help me. Thanks
It seem to be a solution or an answer.