|
分類:[VB.NET]
エラー処理はしておりませんので適時実施して下さい。 Private Sub Form1_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load DataGridView1.ColumnCount = 20 DataGridView1.RowCount = 20 DataGridView1.AutoResizeColumns() End Sub Private Sub DataGridView1_CellMouseDoubleClick(ByVal sender As Object, _ ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) _ Handles DataGridView1.CellMouseDoubleClick Dim iData As IDataObject = System.Windows.Forms.Clipboard.GetDataObject() Dim myStr As String = CType(iData.GetData(DataFormats.UnicodeText), String) With DataGridView1 Dim xlData() As String = Split(myStr, vbCrLf) For i As Integer = 0 To UBound(xlData) - 1 Dim xlComData() As String = Split(xlData(i), vbTab) For j As Integer = 0 To UBound(xlComData) .Item(e.ColumnIndex + j, e.RowIndex + i).Value = xlComData(j) Next j Next i .AutoResizeColumns() End With End Sub
|