AD
Administrator
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?
SS
Steve Smith
July 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?
AD
Administrator
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.