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

  • Home
  • SEARCH
  • 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 1077097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:31:31+00:00 2026-05-16T21:31:31+00:00

I definitely searched for this, but I can’t find the answer, even though it

  • 0

I definitely searched for this, but I can’t find the answer, even though it seems so trivial.

I have a variable in ASP.NET that returns a string.

string[] arrayOfThings { get { return new string[] { ... } } }

And I have call to it in ASP

Dim someString
For Each someString In someClass.arrayOfThings
    # Do Something with someString
Next

This does not work. It returns a ‘Type Mismatch’ Exception.

When I try to debug, IsArray(someClass.arrayOfThings) returns True, but it has no Count, no attributes, nothing. UBound(someClass.arrayOfThings) is 0, which is what I would expect since it only has 1 element in it. However, I’m unable to reference the element by someClass.arrayOfThings(0)

I’m new to ASP, but I can’t figure out what I’m doing wrong. I so wish ASP was strongly typed.

Edit: I tried creating an Array with the same value, and compare it to what I get from arrayOfThings, and in the debugger window they look identical, but in one case I can loop through it and in the other, I cannot.

Just FYI, currently I have it working like this:

I have a variable in ASP.NET that returns a string.

string arrayOfThings { get { return String.Join(",", new string[] { ... }) } }

And then in ASP

Dim someString
For Each someString In Split(someClass.arrayOfThings, ",")
    # Do Something with someString
Next

And this works.

  • 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-16T21:31:32+00:00Added an answer on May 16, 2026 at 9:31 pm

    Use this approach instead:-

     object[] arrayOfThings { get { return new object[] { ... } } } 
    

    The problem with using a string array is that it marshals as a SAFEARRAY of BSTR in COM speak. However VBScript can only cope with SAFEARRAY of VARIANT. Using object should result in an array of Variant.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I realize there's no definitely right answer to this question, but when people talk
I searched all of the relevant Capistrano issues, but couldn't find something that even
Perhaps not directly programming related, but definitely product / commercially related. And I can't
This is definitely a bit of a noob question, but my searches so afar
The first one is definitely something that works, but which one below is the
I have been working on a legacy C++ application and am definitely outside of
While for the most part you can generate the same MSIL, there are definitely
I'm developing on Windows, and I've searched everywhere without finding anyone talking about this
I definitely like MS Access as an RAD-Tool for small-scope data-driven applications. But one
I'm at my wit's end when it comes to this. JavaScript definitely isn't my

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.