2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
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. C# 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; } } VB 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 Here is a sample that illustrates this: http://websamples.syncfusion.com/samples/KB/Grid.Windows/AvoidingPasteError/main.htm |
2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
This page will automatically be redirected to the sign-in page in 10 seconds.