في نفس المشروع الذي وضعه الأخ princelovelorn عدل كود اللصق بالكود التالي :
كود :
Private Sub DataGridView1_KeyDown(sender As Object, e As KeyEventArgs) Handles DataGridView1.KeyDown
If e.Control AndAlso e.KeyCode = Keys.V Then
Try
' Get the text from the clipboard
Dim clipboardText As String = Clipboard.GetText()
' Iterate through all selected cells
For Each selectedCell As DataGridViewCell In DataGridView1.SelectedCells
' Check if the cell is not read-only
If Not selectedCell.ReadOnly Then
' Paste the clipboard text into the cell's value
selectedCell.Value = clipboardText
End If
Next
Catch ex As Exception
MessageBox.Show("An error occurred while pasting: " & ex.Message, "Paste Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End If
End Subقال صلى الله عليه وسلم:
«كلمتان خفيفتان على اللسان
ثقيلتان في الميزان،حبيبتان إلى الرحمن:
سبحان الله وبحمده، سبحان الله العظيم».
