The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
I have the following line of code in the AfterPaste event of a grid control
moGrid(moGrid.CurrentCell.RowIndex, GridCol.Installed).Text = False
However, this line trips a "Grid is in updating mode" error. I''ve tried CancelUpdate and CancelEdit before that line, but to no avail.
Anyone know a) why this error occurs and b) how I can prevent it?
TIA!
Steve.
ADAdministrator Syncfusion Team July 28, 2005 08:22 PM UTC
I am not sure what the AfterPaste event is? Can you post the code that you use to subscribe to this event? Is it an event you added?
SSSteve SmithJuly 28, 2005 10:41 PM UTC
Sorry, this was code I inherited and I (wrongly) assummed the AfterPaste event was Syncfusions. Anyway, here''s how the code looks (the error is tripped by the first line in AfterPaste:
Public WithEvents moGrid As Syncfusion.Windows.Forms.Grid.GridControl
Private Sub moGrid_ClipboardPaste(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridCutPasteEventArgs) Handles moGrid.ClipboardPaste
Me.SetDirty(True)
tmr.Interval = 200 ''give the paste enough time to complete, then fire the update
tmr.Start()
End Sub
Private Sub tmr_Elapsed(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs) Handles tmr.Elapsed
AfterPaste()
tmr.Stop()
End Sub
Private Sub AfterPaste()
moGrid(moGrid.CurrentCell.RowIndex, GridCol.Installed).Text = False '' THIS IS THE OFFENDING LINE!!
If moGrid(moGrid.CurrentCell.RowIndex, GridCol.LineType).Text = CEnumsInfo.LineTypes.Comment.ToString Then
moGrid(moGrid.CurrentCell.RowIndex, -1).Font.Bold = True
Else
moGrid(moGrid.CurrentCell.RowIndex, -1).Font.Bold = False
End If
If moGrid(moGrid.CurrentCell.RowIndex, GridCol.LineType).Text = CEnumsInfo.LineTypes.SubAsy.ToString Then
moGrid(moGrid.CurrentCell.RowIndex, GridCol.SubAssembly).Text = "+"
End If
moGrid.RowHeights.ResizeToFit(Syncfusion.Windows.Forms.Grid.GridRangeInfo.Col(GridCol.Material))
If moGrid.CurrentCell.RowIndex = moGrid.RowCount Then
moGrid.RowCount += 1
End If
End Sub
>I am not sure what the AfterPaste event is? Can you post the code that you use to subscribe to this event? Is it an event you added?
ADAdministrator Syncfusion Team July 28, 2005 11:28 PM UTC
Are you using multiple threads? If so, and you are not using grid.InvodekRequired checked before accessing grid methods, you can see exceptions like this.
But if you are not using multiple threads, then it might be that the 200 ms is not long enough for the paste to complete. You caold lengthen this time to see if this is the problem.