Dhruvan

Hi,
I am trying to cache data in excel sheets and for that I referred to the below msdn link...
http://msdn2.microsoft.com/en-us/lib...f3(VS.80).aspx

I got a piece of code from there which caches a dataset. I tried doing that, but it is throwing a null reference exception on the "If Not (Me.IsCached("dataSet1")) Then" line.

Has anybody been able to use that code. If so, please let me know as to what could be going wrong. If somebody has any better ideas on how to cache data in excel sheets, please let me know that also.

Thanks,
Dhruvan.


Re: Visual Studio Tools for Office Data caching in Excel 2007

Carlos Quintero - MVP

Hi Dhruvan,

This forum is for extensibility of Visual Studio (macros, add-in, templates, wizards or SDK packages). Try in the general .NET forums for programming questions.






Re: Visual Studio Tools for Office Data caching in Excel 2007

Dhruvan

Hi,

I have been able to narrow down the "object reference not set to an instance of the object" exception to the designer.vb file. It occurs because the IRuntimeServiceProvider instance, RuntimeCallback, doesn't get instantiated. Either that or the problem is with it's GetService method, because it does not return anything.

Can anybody help me out

Thanks,

Dhruvan.





Re: Visual Studio Tools for Office Data caching in Excel 2007

Andrew Cherry [MSFT]

Hi Dhruvan -

Can we get some more information so we can try to help you

IE, what version of VSTO, what version of Office, where you're trying to add that code

Thanks,

Andrew






Re: Visual Studio Tools for Office Data caching in Excel 2007

Dhruvan

Hi,

I am using Visual Studio 2005 Tools for Office Second Edition and Office 2007 Trial version. I have tried even in Office 2003 full version.

I tried the code as below..

Code Snippet

Public Class ThisAddIn

<Cached()> Public dataset1 as dataset

Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup
' Start of VSTO generated code

Me.Application = CType(Microsoft.Office.Tools.Excel.ExcelLocale1033Proxy.Wrap(GetType(Excel.Application), Me.Application), Excel.Application)

' End of VSTO generated code

dataset1 = new dataset

End Sub

Private Sub ThisAddIn_Shutdown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shutdown

Try

If Me.IsCached("dataset1") Then <---- It is throwing the error here

End If

Catch ex As Exception

MsgBox(ex.Message)

End Try

End Sub

End Class

I was able to narrow down the exception to the Designer.vb file of this add-in, as mentioned in the previous post.

Hope the information is enough.

Thanks,

Dhruvan.





Re: Visual Studio Tools for Office Data caching in Excel 2007

Ji Zhou ¨C MSFT

Hi Dhruvan,

Data cache is not supported in VSTO SE. You can get a table which describes the features available by product combination in this link:

http://msdn2.microsoft.com/en-us/library/aa942839(VS.80).aspx

It pointed out Data cache is supported only in VSTO 2005 document level solution.

Thanks

Ji