We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Copy and Pasting grid ranges with cell selected text

Hi there, I would like to ask about the behavior of the gridcontrol when cutting and pasting. In particular with the "ActivationCurrentCellBehavior" set to "GridCellActivateAction.SelectAll". I have notice something (which I think is undesirable) when cutting and pasting under certain situations. Taking the following actions: - A grid range (from a grid control or from excel) is copied. - Text within a cell is selected. - Then a paste is triggered (ie control-v is pressed). Produces the following results: - Text is only pasted into that cell. - Different cells originally selected and copied are pasted in that cell separated with what appears to be tabs. Is this behavior that you would be expected under these conditions?? Or would you expect that the whole grid range be pasted into the gridcontrol?? Also if .SelectAll is set and a grid range is tried to be selected (ie click and dragging over several cells) then a copy is applied. This cause only the text in the first cell to be copied because the text is selected from the .SelectAll property. Again would this be the expected behavoir?? Or would you expect that the range selected be copied?? Thanks in advance.

1 Reply

AD Administrator Syncfusion Team June 13, 2005 05:30 AM

While a current cell is active and has selected text, if you press ctl+V, the paste will be handled by the control in the cell (TextBox by default), and the paste will replace the selected text. If you try this with no selected text in the currentcell, then the paste will be handled by the grid. If you do not want the active cell control to ever handle the paste, you can catch this event.
Private Sub grid_CurrentCellControlKeyMessage(ByVal sender As Object, ByVal e _
    As GridCurrentCellControlKeyMessageEventArgs) Handles GridControl1.CurrentCellControlKeyMessage
         Dim keyCode As Keys = CType(e.Msg.WParam.ToInt32 And Keys.KeyCode, Keys)
        If keyCode = Keys.V And ((Control.ModifierKeys And Keys.Control) <> 0) Then
            Me.GridControl1.CurrentCell.BeginEdit()
            Me.GridControl1.CutPaste.Paste()
            e.Handled = True
            e.Result = True
        End If
    End Sub

Loader.
Live Chat Icon For mobile
Up arrow icon