I have a simple data grid view and I am copying its content as below:
When i paste this to note pad, it appear as below:
How can i remove the blank line between 1 Jake and 3 Tom?
I am using this code to copy:
private void copySelectedToolStripMenuItem_Click(object sender, EventArgs e)
{
if (this.dataGridView1.GetCellCount(DataGridViewElementStates.Selected) > 0)
{
try
{
Clipboard.SetDataObject(
this.dataGridView1.GetClipboardContent());
}
catch (System.Runtime.InteropServices.ExternalException)
{
// "The Clipboard could not be accessed. Please try again.";
}
}
}
Is there is any better way to copy only selected? Please Help.