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

Paste

How can I cancel a paste in a particular row int the grid? IN VB.NET please.

3 Replies

AD Administrator Syncfusion Team June 25, 2004 11:54 AM UTC

You can handle the grid.Model.PasteCelltext event. ''in formload AddHandler Me.GridDataBoundGrid1.Model.PasteCellText, AddressOf gridModel_PasteCellText
''the handler
Private Sub gridModel_PasteCellText(ByVal sender As Object, ByVal e As GridPasteCellTextEventArgs)
        If e.RowIndex = 2 Then ''dont paste into row 2
            e.Cancel = True
        End If
    End Sub


FO Francis Ouellet June 25, 2004 12:19 PM UTC

The event never fire. The grid is on an mdiChild form. >You can handle the grid.Model.PasteCelltext event. > >''in formload > AddHandler Me.GridDataBoundGrid1.Model.PasteCellText, AddressOf gridModel_PasteCellText > > >
>''the handler
>Private Sub gridModel_PasteCellText(ByVal sender As Object, ByVal e As GridPasteCellTextEventArgs)
>        If e.RowIndex = 2 Then ''dont paste into row 2
>            e.Cancel = True
>        End If
>    End Sub
>


AD Administrator Syncfusion Team June 25, 2004 12:38 PM UTC

The event fires when you are pasting text information, but not style information. So, the event should fire if you are using a GridDataBoundGrid, or if you are using a GridControl and pasting information copied from outside the grid. If you are using a GridControl, and want to copy jsut text information from a grid (as opposed to just the cell style information), then you can turn off support for copying styles by setting Me.GridDataBoundGrid1.Model.CutPaste.ClipboardFlags = GridDragDropFlags.Text (you also may want to set some other flags there are well). But if you want to copy styles, this event will not work for you. In that case, you would have to handle ClipboardPaste which will be more work since it is not called on a cell by cell basis.

Loader.
Live Chat Icon For mobile
Up arrow icon