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

AfterPaste error

Thread ID:

Created:

Updated:

Platform:

Replies:

32395 Jul 28,2005 03:40 PM Jul 28,2005 07:28 PM Windows Forms 3
loading
Tags: GridControl
Steve Smith
Asked On July 28, 2005 03:40 PM

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.

Administrator [Syncfusion]
Replied On July 28, 2005 04:22 PM

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?

Steve Smith
Replied On July 28, 2005 06:41 PM

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?

Administrator [Syncfusion]
Replied On July 28, 2005 07:28 PM

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.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

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.

;