question

SinghSg avatar image
0 Votes"
SinghSg asked DanielZhang-MSFT commented

VSTO 2010 Excel addin ListObject "Object reference not set to an instance of an object"

Hi,

Using VSTO VS 2019 for excel addin development

I have populated DataTable using an API but i'm not able to bind the list object to data-table to display data on excel
I get error "Object reference not set to an instance of an object"

My code snippet


 Error line
                 this.jiraIssueListObject.AutoSetDataBoundColumnHeaders = true;
                 this.jiraIssueListObject.SetDataBinding(dtIssueList);

//Excel Variables
System.Windows.Forms.BindingSource jiraIssueBindingSource;
private Microsoft.Office.Tools.Excel.ListObject jiraIssueListObject;



Reference link




Any help will be highly appreciated.

thanks

dotnet-csharp
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @SwatantraSingh-2674,
Based on error message, please check if you have an existing ListObject named jiraIssueListObject that exists on your worksheet.
And please refer to this document for more details.
Best Regards,
Daniel Zhang


0 Votes 0 ·

@DanielZhang-MSFT thanks for the help

There's only one List Object in the entire plugin

Usually this error message we get when an object is not instantiated .... do we need to do one for list object? If yes, how?


Again, appreciate the help.

0 Votes 0 ·

Hi @SwatantraSingh-2674,
Please refer to the SetDataBinding(Object) part of this document.
Best Regards,
Daniel Zhang


0 Votes 0 ·

0 Answers