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.
Unfortunately, activation email could not send to your email. Please try again.

Copy and Pasting grid ranges with cell selected text

Thread ID:

Created:

Updated:

Platform:

Replies:

30147 Jun 13,2005 02:00 AM Jun 13,2005 06:30 AM Windows Forms 1
loading
Tags: GridControl
Robert Charlebois
Asked On June 13, 2005 02:00 AM

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.

Administrator [Syncfusion]
Replied On June 13, 2005 06: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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;