ONCE BU FONKSIYONU EKLE;
———————-
Sub pastefromclipboardtodatagridview(ByVal dgv As DataGridView)
Dim rowSplitter As Char() = {vbCr, vbLf}
Dim columnSplitter As Char() = {vbTab}
‘get the text from clipboard
Dim dataInClipboard As IDataObject = Clipboard.GetDataObject()
Dim stringInClipboard As String = CStr(dataInClipboard.GetData(DataFormats.Text))
‘split it into lines
Dim rowsInClipboard As String() = stringInClipboard.Split(rowSplitter, StringSplitOptions.RemoveEmptyEntries)
‘get the row and column of selected cell in grid
Dim r As Integer = dgv.SelectedCells(0).RowIndex
Dim c As Integer = dgv.SelectedCells(0).ColumnIndex
‘add rows into grid to fit clipboard lines
If (dgv.Rows.Count < (r + rowsInClipboard.Length)) Then
dgv.Rows.Add(r + rowsInClipboard.Length – dgv.Rows.Count)
End If
‘ loop through the lines, split them into cells and place the values in the corresponding cell.
Dim iRow As Integer = 0
While iRow < rowsInClipboard.Length
‘split row into cell values
Dim valuesInRow As String() = rowsInClipboard(iRow).Split(columnSplitter)
‘cycle through cell values
Dim iCol As Integer = 0
While iCol < valuesInRow.Length
‘assign cell value, only if it within columns of the grid
If (dgv.ColumnCount – 1 >= c + iCol) Then
dgv.Rows(r + iRow).Cells(c + iCol).Value = valuesInRow(iCol)
End If
iCol += 1
End While
iRow += 1
End While
End Sub
—————
1 ADET DATAGRIDVIEW YARAT
1 ADET BUTTON YARAT
CİFT TIKLA BUTTONA
KOD:
DataGridView1.AllowUserToAddRows = False
DataGridView1.Rows.Add()
pastefromclipboardtodatagridview(DataGridView1)
DataGridView1.AllowUserToAddRows = False
DataGridView1.Rows.Add()
pastefromclipboardtodatagridview(DataGridView1)


![[IMG]](https://i0.wp.com/gyazo.com/10ca682be9b95b4f7cbd98a88b6a9346.png)
![[IMG]](https://i0.wp.com/gyazo.com/8a3b4b48bce63ed334014fc691d7dd84.png)
![[IMG]](https://i0.wp.com/gyazo.com/2d2e377fb43e72071fea0badeff9ce40.png)
![[IMG]](https://i0.wp.com/gyazo.com/4e961340cb252672b12df095daef6db9.png)
![[IMG]](https://i0.wp.com/gyazo.com/4f41d1e6087a3842406e3e3fe42dd2e5.png)
![[IMG]](https://i0.wp.com/gyazo.com/e000cc0bbab5df9df3611f343e0c7b4e.png)
![[IMG]](https://i0.wp.com/gyazo.com/8cc4dde1552efa76a347b01c947bda94.png)
![[IMG]](https://i0.wp.com/gyazo.com/492448a4d89220c6c8eabeb3561e072b.png)
