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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:11:28+00:00 2026-05-26T12:11:28+00:00

I am having issues assinging values to a multi-dimensional array. I am trying to

  • 0

I am having issues assinging values to a multi-dimensional array.

I am trying to build a 2 col, unlimited row array and populate with data from a data reader.

Dim tblArry(,) As String = {}

If reader.HasRows Then
  While reader.Read()
      ' Call Read before accessing data.
      Dim tempTbl As String = "tblLang" & reader.Item(0)
      Dim tempTblTwoLett As String = reader.Item(1)

      tblArry = New String(tempTbl, tempTblTwoLett)

' Tried this too....
tblArry = {New String(tempTbl, New String(tempTblTwoLett)} 
' and this...
tblArry = New String(tempTbl), New String(tempTblTwoLett)

When I use a Jagged Array I can get this to work. The Reader portion is working just fine, but the coding is just not clean for this problem.

Any suggestions would be appreciated.

Thanks

  • 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-26T12:11:29+00:00Added an answer on May 26, 2026 at 12:11 pm

    Use a List instead of an array.

    Dim langs As New List(Of String())()
    
    While reader.Read()
      Dim temp(1) As String
      temp(0) = "tblLang" & reader.Item(0)
      temp(1) = reader.Item(1)
    
      langs.Add(temp)
    End While
    

    .Net makes a distinction between array types and collections types. Array types are meant to have fixed sizes, so appending to the end like you want to do doesn’t work well. Collections are meant to be more flexible.

    Regardless, why in the world would you expect to append to the end of an array by assigning to it!? The best you could hope for there is that you replace the entire array.

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

Sidebar

Related Questions

I am having issues reading data from a socket. Supposedly, there is a server
I'm having issues trying to deserializing my xml string that was from a dataset..
Having issues referencing $(this) from within a the nested ajax 'success' function... I know
Having issues calling the ReportingService2005.FindItems() method from within powershell v2. $rs = New-WebServiceProxy -Uri
Having issues getting myself started on MVC3 Trying to define a simple route here
Im having issues when trying to post a IList back to the controller here
Im having issues trying to get a custom snapin to display in the Add/Remove
having issues getting a value from a NSString in my view controller to my
Having issues trying to select html injected into the DOM using jquery's load. Works
Having issues getting django custom commands to work. From django documetation , have placed

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.