![]() If columnCreationCounter = rowLines.Length - 1 Then If (currentColumnIndex + columnsData.Length) > Thenįor columnCreationCounter As Integer = 0 To ((currentColumnIndex + columnsData.Length) - currentColumnCount) - 1 If e.Control And (e.Ke圜ode = Keys.C) Thenĭim d As DataObject = datagrid.GetClipboardContent()ĮlseIf (e.Control And e.Ke圜ode = Keys.V) Thenĭim rowLines As String() = Clipboard.GetText(TextDataFormat.Text).Split(New String(0), StringSplitOptions.None) Private Sub datagrid_KeyDown(ByVal sender As System.Object, ByVal e As ) Handles datagrid.KeyDown This case also follows for columns as well. ![]() Note: If you have fewer rows in datagrid but you got more rows in excel, then following code pastes only those no.of rows to the grid. ![]() If you have a scenario where you need to paste the data from excel to datagridview, The following is the PERFECT working code for this. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |