C1TrueDBGrid Shortcut-Keys

Posted by: s.wortmann on 20 April 2022, 7:08 pm EST

  • Posted 20 April 2022, 7:08 pm EST

    I'm wondering if it's possible to use Ctrl+C to copy a selected area of the Grid to insert it with Ctrl+V in a Text-Document.
    If it's possible, a Code in VB.net would be great.

    Thanks and best regards
  • Replied 20 April 2022, 11:14 pm EST

    Hi Stephan,

    You can handle the KeyDown event of the C1TrueDBGrid to check if the Ctrl+C is pressed and suppress the keypress to manually handle the Copy. To copy the data from the selected cells of the C1TrueDBGrid, you can iterate through the selected cells and copy their text into a string variable. Then you can use the Clipboard.SetText() method to set the copied string in the clipboard so that it can be pasted into other programs. Kindly refer to the attached sample showing the same.

    Best Regards,

  • Replied 27 April 2022, 12:57 am EST

    Hi Kartik,
    your example works fine, however the cell-contents of hidden columns are still copied to the clipboard.
    Do you have any idea how to prevent this?

    Best regards
  • Marked as Answer

    Replied 27 April 2022, 2:59 pm EST

    Hi Stephan,

    To skip the hidden columns, you can add a check for the hidden columns in the CopyDataToClipboard method by using the C1DisplayColumn.Visible property. Please refer to the updated sample.

    Kind Regards,

  • Replied 2 May 2022, 11:24 pm EST

    Hi Kartik.

    Thank you very much for your renewed help and the example.
    Everything works as it should.

    Best regards.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels