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

clipboard/pastecelltext event ?

I have a question about the clipboard and how the pastecelltext event gets fired? I have a pastecelltext event that looks as follows.... Private Sub grdRErPA_PasteCellText(ByVal sender As System.Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridPasteCellTextEventArgs) Handles grdRErPA.PasteCellText If CType(e.Style, Syncfusion.Windows.Forms.Grid.GridStyleInfo).ReadOnly Then e.Cancel = True End If Try Dim i As Single = Single.Parse(e.Text) Select Case i Case 0, 301.0F To 332.0F Case Else Throw New Exception("") End Select Catch display error message e.Abort = True End Try End Sub My question is this. If im copying a value of say 201 from one cell to one cell on this form it will fire this event and will display the proper error message. If however the clipboard has string.empty or "" in it and the user does a paste it never goes to the pastecelltext event. How does it know not to fire the event based on it being null or having invalid data? What says dont fire the event if its string.empty in the clipboard versus a invalid number inthe clipboard? Thanks

1 Reply

AD Administrator Syncfusion Team May 18, 2005 03:35 PM UTC

When this code returns psz = "", then no pasting is done and PasteCelltext is not raised.
string psz = null;
if (iData.GetDataPresent(DataFormats.UnicodeText))
	psz = iData.GetData(DataFormats.UnicodeText) as string;
else if (iData.GetDataPresent(DataFormats.Text))
	psz = iData.GetData(DataFormats.Text) as string;
This code is in GridModelDatabinder.cs, the DataBoundPaste method.

Live Chat Icon For mobile
Up arrow icon