-2

I want to make a 1 column data grid in a windows form where I can copy paste data from an excel sheet.

I am able to create the data grid using visual studio but ctrl+c &V is not working while copying data from excel sheet.

-Sa

leppie
  • 112,162
  • 17
  • 191
  • 293
Sarik
  • 1
  • 1
  • 1
    Of course CTRL+C and CTRL+V is not going to work. You need to define event handlers for that. The DataGrid is not going to do this for you automagically. – Camilo Terevinto Jan 08 '16 at 19:07

1 Answers1

1
  1. See this to implement Ctrl+V shortcut.

  2. Use

    string txt = Clipboard.GetText(); 
    

    to get the text from the Clipboard.

  3. Excel will provide tab-separated values for each cell in the row, while rows are separated by \r\n. Insert it into your grid as you like.

Community
  • 1
  • 1
Vlad Feinstein
  • 10,206
  • 1
  • 10
  • 24