Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8704013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:59:36+00:00 2026-06-13T02:59:36+00:00

I have this .NET 4.0 code: var myTable = tables[1]; myTable = tables.Item[Table1]; myTable

  • 0

I have this .NET 4.0 code:

var myTable = tables[1];
myTable = tables.Item["Table1"];
myTable = tables.OfType<Excel.ListObject>().FirstOrDefault(t => t.Name == "Table1");

I am trying to compile with .NET 3.5 and getting a bunch of errors:

Error 23 Property, indexer, or event ‘Item’ is not supported by the
language; try directly calling accessor method
‘Microsoft.Office.Interop.Excel.ListObjects.get_Item(object)’

and

Error 24 ‘Microsoft.Office.Interop.Excel.ListObjects’ does not contain
a definition for ‘OfType’ and the best extension method overload
‘System.Linq.Queryable.OfType(System.Linq.IQueryable)’ has
some invalid arguments

and

Error 25 Instance argument: cannot convert from
‘Microsoft.Office.Interop.Excel.ListObjects’ to
‘System.Linq.IQueryable’

Can you please guide me on exactly what these errors mean so that I can try to convert this to .NET 3.5?

Thank you so much for your advice.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T02:59:36+00:00Added an answer on June 13, 2026 at 2:59 am

    This question refers to an answer given for This command requires at least two rows of source data; the code is showing 3 different ways of accessing a table/listobject in code.

    This was the code I posted:

        var myTable = tables[1];
        var myTable = tables.Item["Table1"];
        var myTable = tables.OfType<Excel.ListObject>().FirstOrDefault(t => t.Name == "Table1");
    

    I meant to illustrate that there are different ways of accessing a table in code.

    To put it in context, I have created a Ribbon with a single button called “TestButton”. Here is the entire code, should work with 3.5:

    using Excel = Microsoft.Office.Interop.Excel;
    
    
        private void TestButton_Click(object sender, RibbonControlEventArgs e)
        {
            var worksheet = (Excel.Worksheet) Globals.ThisAddIn.Application.ActiveSheet;
            var tables = worksheet.ListObjects;
            var table = tables.Item["Table1"]; // this is the line you are referring to
    
            //do something with table
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code in my ASP.NET application written in C# that is trying
I am new to asp.net. I have this code: function onSubmitForm() { var formDOMObj
i have seen this code : var myNet = require (net); and in some
I have the following Code var page = '<h1>Hello!</h1><p>FOO</p><span class=username>this is ur name</span><p>sample text</p>';
I have this asp.net code: @foreach( var database in Model) { if (!(firstTime ==
I have this js code: var id = document.getElementById(myDiv).getAttribute(data-id); et=Your Message Here; el=http://x2.xclicks.net/sc/out.php?s=+id+ sl=new
I have this vb.net code ( but I think meaning code is equivalent for
I have this code written in .NET 4.0 using VS2010 Ultimate Beta 2: smtpClient.Send(mailMsg);
I have this code : http://jsfiddle.net/VAkLn/6/ When i add a table : http://jsfiddle.net/VAkLn/7/ this
I have this webdav code thats creating folders in SharePoint: HttpWebRequest request = (System.Net.HttpWebRequest)HttpWebRequest.Create(folderAddress);

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.