ditemi almeno se c'è qualche metodo più diretto
codice:
Private Sub CopyAllRowsToClipboard_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles CopyAllRowsToClipboard.LinkClicked
Dim sb As New StringBuilder()
For Each cell As DataGridViewTextBoxColumn In Me.DataGridView1.Columns
sb.Append(cell.HeaderText)
sb.Append(vbTab)
Next
sb.Remove(sb.Length - 1, 1)
sb.Append(vbNewLine)
For Each row As DataGridViewRow In Me.DataGridView1.Rows
For Each cell As DataGridViewCell In row.Cells
sb.Append(cell.Value)
sb.Append(vbTab)
Next
sb.Remove(sb.Length - 1, 1)
sb.Append(vbNewLine)
Next
sb.Remove(sb.Length - 1, 1)
Clipboard.SetText(sb.ToString())
MessageBox.Show("Dati copiati in memoria")
End Sub