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 7572787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:00:52+00:00 2026-05-30T16:00:52+00:00

i have the following code which walks through an Excel file and this works

  • 0

i have the following code which walks through an Excel file and this works fine

Please note that the following line does work well (folder is being set earlier in the code)

Console.WriteLine("Value found in {1}: {0} ", Obj.Text, folder)

the whole

For Each xlWorkSheet In xlWorkBook.Worksheets
    For rCnt As Integer = 2 To xlWorkSheet.UsedRange.Rows.Count 'we start at 2 becuase we do not need the first header row

        For cCnt As Integer = 1 To xlWorkSheet.UsedRange.Columns.Count

            Dim Obj As Range = CType(xlWorkSheet.UsedRange.Cells(rCnt, cCnt), Range)

            Console.WriteLine("Value found in {1}: {0} ", Obj.Text, folder)

        Next


        RaiseEvent ImportChanged()
    Next

Next

But I would like to fill a dictionary with the items, but the moment I do that it complains it “not being an instance of an object” even if I cast it to Cstr() or use .toString

Anyone knows why?

Dim EntryDetails As Dictionary(Of String, String)

        For Each xlWorkSheet In xlWorkBook.Worksheets
            For rCnt As Integer = 2 To xlWorkSheet.UsedRange.Rows.Count 'we start at 2 becuase we do not need the first header row

                For cCnt As Integer = 1 To xlWorkSheet.UsedRange.Columns.Count

                    Dim Obj As Range = CType(xlWorkSheet.UsedRange.Cells(rCnt, cCnt), Range)

                    Console.WriteLine("Value found in {1}: {0} ", Obj.Text, folder)
                    EntryDetails.Add("demo", Obj.Text) ' THIS DOESNT WORK
                    EntryDetails.Add("demo", Obj.Text.ToString) ' THIS DOESNT WORK
                    EntryDetails.Add("demo", CStr(Obj.Text)) ' THIS DOESNT WORK

                Next


                RaiseEvent ImportChanged()
            Next

        Next
  • 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-05-30T16:00:53+00:00Added an answer on May 30, 2026 at 4:00 pm

    You haven’t created an actual instance of EntryDetails

    Add the New keyword to the first line so that the constructor is called:

    Dim EntryDetails As New Dictionary(Of String, String)
    
    For Each xlWorkSheet In xlWorkBook.Worksheets
        // ...
    Next
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code which works just fine when the method is POST,
I have the following code which works fine. However, I only want to return
I have following code which works fine in firefox and ie 8, but in
I have the following code which works great:- $('.ajax a').click(function() { getpageajax(this.href); return false;
I have following code which works fine in iPhone application but in iPad I
I have following code which works fine, however when I updated to Lion I
I have the following code which works fine however historically and again now I
I have the following code which reads in the follow file, append a \r\n
I have following code which seems to work fine: <%if group.employees.count > 0%> <td><%=
I have following code which works as is, but does not work when cache=T

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.