CTRL+C and CTRL+V in grid control
-
Hi, I'm new to C# and .Net architecture , so sorry about the silly question.... :-\ . I'm using a grid control in order to display data from the data base. My problem is when the user press the CTRL+C in a specific cell in order to copy the data to a different cell. The result is that the new cell contain the data of the entire row , instead of the data of the copied cell. note that if I use the mouse right click and "copy" <-> "paste" it is working fine. My question is how can I capture the CTRL+C and CTRL+V with the keyboard? With best regards, Eli
-
Hi, I'm new to C# and .Net architecture , so sorry about the silly question.... :-\ . I'm using a grid control in order to display data from the data base. My problem is when the user press the CTRL+C in a specific cell in order to copy the data to a different cell. The result is that the new cell contain the data of the entire row , instead of the data of the copied cell. note that if I use the mouse right click and "copy" <-> "paste" it is working fine. My question is how can I capture the CTRL+C and CTRL+V with the keyboard? With best regards, Eli
Are you talking about the DataGridView control? I don't seem to be having any sort of problem with CTRL-C, CTRL-V to copy and paste from cell to cell with that control. Anyways, you might take a look at the grid's KeyDown event and see if you can use the e.Modifiers to capture the Control key, and e.KeyCode to capture the 'C' or 'V', but, to be honest, I don't think that event will trigger in an editable cell of the DataGridView. The other option I can think of is to override ProcessCmdKey and see if you can capture the key combinations there.