Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
3455
Restrict the paste by Ctrl + V or context menu of a WinGrid cell
posted

Hi,

I have a numeric column, so only digits are allowed in the cells which come under this column.

I have restricted the characters other than digits by handling key down event.

But even if I done this it is possible to copy text to clipboard and paste into this cell using context menu or the shortcut Ctrl + V when this cell is in editing mode (insertion point inside the cell).

Regards,

Ceaser

Parents
No Data
Reply
  • 4555
    posted

    Hi,

    The Grid has its own built in functionality that handles copy and paste. You may need to cancel the event. The following code snippet would execute the Process Data sub and cancel the Grid's Copy/Paste functionality.

       Private Sub UltraGrid1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles UltraGrid1.KeyDown

            Select Case e.KeyData

                Case Keys.Control Or Keys.V

                    Me.ProcessData()
                    e.Handled = True
                    Exit Select
            End Select


        End Sub

     

    Magued

Children
No Data