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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:43:37+00:00 2026-06-02T05:43:37+00:00

I am new to VB in general. I am going through some old VB

  • 0

I am new to VB in general. I am going through some old VB code and I see statements like –

  Addr.AddrType(CStr(0)).A_Type = " "

Why does the integer 0 have to be converted to a string?

Note that Addr is defined as

 Public Addr As clsAddressDetail 

AddrType is defined as a collection

 Public AddrType As New Collection
  • 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-02T05:43:38+00:00Added an answer on June 2, 2026 at 5:43 am

    The Collection class being used here has what is effectively an overloaded indexer. My emphases:

    Returns a specific element of a Collection object either by position
    or by key
    . Read-only.

    Default Public ReadOnly Property Item( _
    ByVal { Key As String | Index As Integer | Index As Object } _ ) As Object
    

    Parameters

    Key

    A unique String expression that specifies a key string that can be used, instead of a positional index, to access an element of the
    collection. Key must correspond to the Key argument specified when the
    element was added to the collection.

    Index

    (A) A numeric expression that specifies the position of an element of the collection. Index must be a number from 1 through the value of
    the collection’s Count Property (Collection Object). Or (B) An Object
    expression that specifies the position or key string of an element of
    the collection.

    So, if you ask for AddrType(0), you are asking for the zeroth member of the collection, which for this 1-based collection is an error. But if you ask for AddrType("0"), you are asking for that member which was added with Key "0". Any string can be used as a key – it’s just that the particular string used here is the string representation of a number.

    Incidentally, stylistically I would say writing CStr(0) rather than "0" isn’t particularly nice…

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

Sidebar

Related Questions

I'm going through some new code I just wrote and adding NDoc sytle comments
I'm new to ExtJS and only have minimal javascript skills in general. I'm going
I'm going through a book of general c# development, and I've come to the
New to programming in general, so I'm probably going about this the wrong way.
I'm going through some book which tries to teach android development. In the book,
I am new to programming in general so please keep that in mind when
I'm new to source control in general and am wondering how to handle the
I'm new to web programming in general so this is probably a really simple
I'm pretty new to database development in general and I've never used ORM before.
I am pretty new to WCF in general. What little experience I have comes

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.