Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
336
Error for grid.PerformAction(ToggleRowSel) when Windows Clipboard is locked. (Exception occurs).
posted

Certain applications in windows may lock the Windows clipboard for extended periods of time.  I have noticed grid.PerformAction(ToggleRowSel)  will throw an exception if this clipboard is locked.  This only seems to occur if DisplayLayout.Override.AllowMultiCellOperations includes AllowMultiCellOperation.Paste.  If you set AllowMultiCellOperations = AllowMultiCellOperation.Default this will not occur.

If you look at the exception stack trace of the PerformAction, it is calling CurrentState which calls some method that checks the clipboard which inturn throw an exception if the Clipboard is locked. 

You would assume PerformAction does't nesscarily need any external exception handling everytime it's called because it returns a boolean, but after looking though the Grid code it seems there is no exception handling in any of these methods in the grid stack trace. 

Just wanted to get Infragistics' take on this....?

Attached is a project that demos this.

 See the exception:

 

System.Runtime.InteropServices.ExternalException: Requested Clipboard operation did not succeed.
   at System.Windows.Forms.Clipboard.GetDataObject(Int32 retryTimes, Int32 retryDelay)
   at System.Windows.Forms.Clipboard.GetDataObject()
   at Infragistics.Win.UltraWinGrid.MultiCellOperationInfo.GetDataFromClipboardHelper(Boolean justCheckForExistence, ClipboardData& data, Exception& error)
   at Infragistics.Win.UltraWinGrid.MultiCellOperationInfo.CanPerformMultiCellOperation(MultiCellOperation operation)
   at Infragistics.Win.UltraWinGrid.MultiCellOperationInfo.GetMultiCellOperationRelatedState()
   at Infragistics.Win.UltraWinGrid.UltraGrid.get_CurrentState()
   at Infragistics.Win.UltraWinGrid.UltraGrid.PerformAction(UltraGridAction actionCode, Boolean shift, Boolean control)
   at Infragistics.Win.UltraWinGrid.UltraGrid.PerformAction(UltraGridAction actionCode)
   at TestClipboard.Form1.btnSelectGridRow_Click(Object sender, EventArgs e) in C:\TFS\dotNet Projects\Main\Source\Projects\TestClipboard\Form1.vb:line 138

 

TestClipboard.zip