26-11-18, 11:25 PM
PHP كود :
Private Sub PasteClipboard(ByVal lstx As DataGridView)
lstx.Rows.Clear()
lstx.Columns.Clear()
For im = lstx.Columns.Count - 1 To 0 Step -1
lstx.Columns.RemoveAt(im)
Next
Dim s As String
Dim i, ii As Integer
Dim arT() As String
Try
s = Clipboard.GetText()
Dim tArr() As String = s.Split(ControlChars.NewLine)
arT = tArr(0).Split(vbTab)
Dim word As String
For Each word In arT
lstx.Columns.Add(word, word)
Next
Dim cc, iRow, iCol As Integer
For i = 1 To tArr.Length - 2
lstx.Rows.Add("")
If tArr(i) <> "" Then
arT = tArr(i).Split(vbTab)
cc = iCol
For ii = 0 To arT.Length - 1
If cc > lstx.ColumnCount - 1 Then Exit For
If iRow > lstx.Rows.Count - 1 Then Exit Sub
With lstx.Item(cc, iRow)
.Value = arT(ii).TrimStart
End With
cc = cc + 1
Next
iRow = iRow + 1
End If
Next
Catch ex As Exception
MsgBox("Please redo Copy and Click on cell")
End Try
End Sub
