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. Image for the cookie policy date
close icon

Can't get token for specified grid when two spreadsheets on form

I have two spreadsheets on a form - on loads an excel file depending upon a date and the other simply populates from data within a spreadsheet.    The two spreadsheets reside on the same form and yet I frequently get a "Cant get token for specified grid" exception when it is trying to refresh one of the spreadsheets.

System.ArgumentException
  HResult=0x80070057
  Message=Can't get token for specified grid
  Source=Syncfusion.Spreadsheet.Windows
  StackTrace:
   at Syncfusion.Windows.Forms.Spreadsheet.Helpers.FormulaHelper.GetSheetToken(SpreadsheetGrid grid, Boolean canThrowException)
   at Syncfusion.Windows.Forms.Spreadsheet.Helpers.FormulaHelper.GetCellReference(SpreadsheetGrid grid, Int32 row, Int32 col)
   at Syncfusion.Windows.Forms.Spreadsheet.SpreadsheetColumn.OnUpdateColumn()
   at Syncfusion.Windows.Forms.CellGrid.GridRow.UpdateCells(Int32 rowIndex, VisibleLinesCollection visibleColumns)
   at Syncfusion.Windows.Forms.CellGrid.GridRow.UpdateCells()
   at Syncfusion.Windows.Forms.CellGrid.VisualContainer.EnsureRows(VisibleLinesCollection visibleRows)
   at Syncfusion.Windows.Forms.CellGrid.VisualContainer.EnsureItems(Boolean ensureColumns)
   at Syncfusion.Windows.Forms.CellGrid.VisualContainer.MeasureChildPanels(Size availableSize)
   at Syncfusion.Windows.Forms.Spreadsheet.VisualContainerExt.MeasureChildPanels(Size availableSize)
   at Syncfusion.Windows.Forms.CellGrid.VisualContainer.MeasureOverride(Size availableSize)
   at Syncfusion.Windows.Forms.CellGrid.VisualContainer.OnPaint(PaintEventArgs e)
   at Syncfusion.Windows.Forms.Spreadsheet.VisualContainerExt.OnPaint(PaintEventArgs e)
   at System.Windows.Forms.Control.PaintTransparentBackground(PaintEventArgs e, Rectangle rectangle, Region transparentRegion)
   at System.Windows.Forms.Control.PaintBackground(PaintEventArgs e, Rectangle rectangle, Color backColor, Point scrollOffset)
   at System.Windows.Forms.Control.PaintBackground(PaintEventArgs e, Rectangle rectangle)
   at System.Windows.Forms.Control.OnPaintBackground(PaintEventArgs pevent)
   at System.Windows.Forms.ScrollableControl.OnPaintBackground(PaintEventArgs e)
   at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
   at System.Windows.Forms.Control.WmPaint(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at Syncfusion.Windows.Forms.CellGrid.ScrollableChildFrame.WndProc(Message& m)
   at Syncfusion.Windows.Forms.CellGrid.SelectionPanel.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


I'll PM send repro and project.


5 Replies

MG Mohanraj Gunasekaran Syncfusion Team April 16, 2019 04:18 PM UTC

Hi Spotty, 

Thanks for using Syncfusion product. 

We have downloaded and able to run your application. And, we have downloaded your shared video but unable to open that video also we have tried to play the video in online but unable to play that file. So, can you please provide the use case to reproduce your reported scenario. It will be helpful us to address as much as possible. 

Regards, 
Mohanraj G 



SP Spotty April 16, 2019 08:24 PM UTC

Ive updated the video repros on the share Scenario1 and scenario 2 reflect different repros of the same exception


SR Sabaridass Ramamoorthy Syncfusion Team April 17, 2019 08:46 AM UTC

Hi Spotty, 

Thanks for your update. 

We can reproduce your reported scenario and we suspect that this is a bug. So, we have forwarded this query to development team for further analysis. So, we will check and update with more details on 24th April 2019. 

Regards, 
Sabaridass R 



SP Spotty January 16, 2020 09:51 PM UTC

Was this actually fixed as I'm getting back to the development a long while later and using 17.4.0.43 version and am able to repro the same issue.   A clean machine with latest Nuget packages.



System.ArgumentException: 'Can't get token for specified grid'


System.ArgumentException
  HResult=0x80070057
  Message=Can't get token for specified grid
  Source=Syncfusion.Spreadsheet.Windows
  StackTrace:
   at Syncfusion.Windows.Forms.Spreadsheet.Helpers.FormulaHelper.GetSheetToken(SpreadsheetGrid grid, Boolean canThrowException)
   at Syncfusion.Windows.Forms.Spreadsheet.Helpers.FormulaHelper.GetCellReference(SpreadsheetGrid grid, Int32 row, Int32 col)
   at Syncfusion.Windows.Forms.Spreadsheet.SpreadsheetColumn.OnUpdateColumn()
   at Syncfusion.Windows.Forms.CellGrid.GridRow.CreateOrRecycleColumnElement(Int32 rowIndex, Int32 colIndex, ScrollAxisRegion colregion)
   at Syncfusion.Windows.Forms.CellGrid.GridRow.OnGenerateVisibleCells(Int32 rowIndex, VisibleLinesCollection visibleColumns)
   at Syncfusion.Windows.Forms.CellGrid.GridRow.GenerateVisibleCells()
   at Syncfusion.Windows.Forms.CellGrid.VisualContainer.CreateOrRecycleRow(Int32 rowIndex, ScrollAxisRegion region)
   at Syncfusion.Windows.Forms.CellGrid.VisualContainer.PregenerateRows(VisibleLinesCollection visibleRows, VisibleLinesCollection visibleColumns)
   at Syncfusion.Windows.Forms.CellGrid.VisualContainer.PreGenerateItems()
   at Syncfusion.Windows.Forms.CellGrid.VisualContainer.MeasureChildPanels(Size availableSize)
   at Syncfusion.Windows.Forms.Spreadsheet.VisualContainerExt.MeasureChildPanels(Size availableSize)
   at Syncfusion.Windows.Forms.CellGrid.VisualContainer.MeasureOverride(Size availableSize)
   at Syncfusion.Windows.Forms.CellGrid.VisualContainer.OnPaint(PaintEventArgs e)
   at Syncfusion.Windows.Forms.Spreadsheet.VisualContainerExt.OnPaint(PaintEventArgs e)
   at System.Windows.Forms.Control.PaintTransparentBackground(PaintEventArgs e, Rectangle rectangle, Region transparentRegion)
   at System.Windows.Forms.Control.PaintBackground(PaintEventArgs e, Rectangle rectangle, Color backColor, Point scrollOffset)
   at System.Windows.Forms.Control.PaintBackground(PaintEventArgs e, Rectangle rectangle)
   at System.Windows.Forms.Control.OnPaintBackground(PaintEventArgs pevent)
   at System.Windows.Forms.ScrollableControl.OnPaintBackground(PaintEventArgs e)
   at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
   at System.Windows.Forms.Control.WmPaint(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at Syncfusion.Windows.Forms.CellGrid.ScrollableChildFrame.WndProc(Message& m)
   at Syncfusion.Windows.Forms.CellGrid.SelectionPanel.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)



AR Arulpriya Ramalingam Syncfusion Team January 17, 2020 12:53 PM UTC

Hi Spotty, 
 
Sorry for the inconvenience. 
 
The reported use can be occurred when performing the user interaction with another grid (spreadsheet) from active spreadsheet. However, we could not reproduce the use case in simple sample and the issue repro sample with video that demonstrates the replication procedure could not be downloaded at our end. So, please enable the permission for us to access the repro sample that will be helpful for us to assist you further with proper solution. 
 
Screenshot 
 
Regards, 
Arulpriya 


Loader.
Live Chat Icon For mobile
Up arrow icon