Search code examples
c#eventscopy-pastecomponentonec1flexgrid

How to copy and paste from cell in C1FlexGrid?


I want to copy and paste from one cell to another / C1FlexGrid copy from selected red cell and paste other value here - shown image

copy from selected red cell/ Image is here

enter image description here

Is there any event like KeyDown etc

Any example code ?


Solution

  • The events KeyDown/KeyPress/KeyUp wont work in this case since your FlexGrid is in edit mode. When in edit mode try using KeyDownEdit/KeyPressEdit/KeyUpEdit events for the FlexGrid.

    VB.NET

    Private Sub C1FlexGrid1_KeyPressEdit(sender As Object, e As KeyPressEditEventArgs)
    Handles c1FlexGrid1.KeyPressEdit
        'Implement logic here
    End Sub
    

    C#:

    public Form1()
        {
            this.c1FlexGrid1.KeyPressEdit += new KeyPressEditEventHandler(this.c1FlexGrid1_KeyPressEdit);
        }
    
        private void c1FlexGrid1_KeyPressEdit(object sender, KeyPressEditEventArgs e)
        {
           // Implement logic here
        }
    

    However, I would suggest you to use ValidateEdit event to implement your use case.