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

How to stop the errors thrown when pasting larger clipboard contents in a GridDataBoundGrid?

Platform: WinForms |
Control: GridDataBoundGrid(Classic)


A IndexOutOfRangeException is thrown when trying to paste clipboard contents that are greater than the number of columns and rows that are available to accommodate the contents. To stop the exception, a condition check in the Model.PasteCellText handler will do good.


private void Model_PasteCellText(object sender, Syncfusion.Windows.Forms.Grid.GridPasteCellTextEventArgs e)


if(e.RowIndex >= this.gridDataBoundGrid1.Model.RowCount)


MessageBox.Show("There is no enough rows to paste the rest of the contents");

e.Cancel = true;

e.Abort = true;




Private Sub Model_PasteCellText(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridPasteCellTextEventArgs)

If e.RowIndex >= Me.gridDataBoundGrid1.Model.RowCount Then

MessageBox.Show("There is no enough rows to paste the rest of the contents")

e.Cancel = True

e.Abort = True

End If

End Sub

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon 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.Close Icon

Live Chat Icon For mobile