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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:40:40+00:00 2026-05-23T16:40:40+00:00

I am trying to initialize a multidimensional array. Here is my syntax; this does

  • 0

I am trying to initialize a multidimensional array. Here is my syntax; this does not create errors but it does not store all values either. Although it correctly prints out all records in this snippet,

        dFirstWeek = CDate(FirstWeek)
        dFirstWeek = DateAdd(DateInterval.WeekOfYear, -1, dFirstWeek)

        Dim dFirstDay As Date
        Dim arrWeekYear(5000, 1) As Date
        Dim i As Integer = 0
        Dim j As Integer = 0
        dFirstDay = dFirstDay.AddDays(1)

        While dFirstWeek <= dLastWeek
            dFirstDay = dFirstWeek
            dFirstWeek = dFirstWeek.AddDays(7)

            While dFirstDay < dFirstWeek
                arrWeekYear(i, j) = (dFirstWeek)
                arrWeekYear(i, j + 1) = (dFirstDay)

                Response.Write(arrWeekYear(i, j).ToString("d"))
                Response.Write("           ;")
                Response.Write(arrWeekYear(i, j + 1).ToString("d"))
                Response.Write("<br>")
                dFirstDay = dFirstDay.AddDays(1)
                j = 0
            End While
            i = i + 1
        End While

later in this code, I try to reprint this array as follows:

            i = 0
            j = 0
            Dim k As Integer = 0
            'Response.Write(arrWeekYear.GetLength(0))

            While k < arrWeekYear.GetLength(0) - 2
                Response.Write(arrWeekYear(i, j).ToString("d"))
                Response.Write("           ;")
                Response.Write(arrWeekYear(i, j + 1).ToString("d"))
                Response.Write("<br>")
                j = 0
                i = i + 1
                k = k + 1
            End While

but this time, only one “j” record appears per “i” record. Why is this? And then after these few records, many dates resembling null dates appear: “1/1/0001 “

So why do all records appear in upper section, but not from lower? Did I insert values wrongly into this array? And it does not have to have fixed number of rows, just a fixed number of columns.

  • 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-23T16:40:40+00:00Added an answer on May 23, 2026 at 4:40 pm
    Dim arrWeekYear(5000, 1) As Date
    

    That’s a multi-dimensional array all right, but the second dimension only has a size of 2! And you access it via j, which is always 0 in your code. That makes no sense. Is that really what you want? I suggest you use a data structure inside your array instead of a multi-dimensional array.

    In fact, you almost never want to use a multi-dimensional array. At all. Complex objects are almost always more appropriate. The only real exception is when you actually want to store a mathematical matrix.

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

Sidebar

Related Questions

I'm trying to initialize an array of structures to all-0's, using the below syntax:
Trying to keep all the presentation stuff in the xhtml on this project and
Trying to do this sort of thing... WHERE username LIKE '%$str%' ...but using bound
This question builds off of a previously asked question: Pass by reference multidimensional array
I am trying to make a multi-dimensional array of characters in ruby, and this
I'm trying to initialize the last element in the array int grades[10]; to grade
I am trying to initialize an array of objects: SinglyLinkedList offeredClasses[22] = {SinglyLinkedList(CSCE101),SinglyLinkedList(CSCE101L),SinglyLinkedList(CSCE150E),SinglyLinkedList(CSCE150EL),SinglyLinkedList(CSCE150EM),SinglyLinkedList(CSCE150EML),SinglyLinkedList(CSCE155),SinglyLinkedList(CSCE155H),SinglyLinkedList(CSCE156),SinglyLinkedList(CSCE230),SinglyLinkedList(CSCE230L),SinglyLinkedList(CSCE235),SinglyLinkedList(CSCE251),SinglyLinkedList(CSCE310),SinglyLinkedList(CSCE322),SinglyLinkedList(CSCE361),SinglyLinkedList(CSCE351),SinglyLinkedList(CSCE451),SinglyLinkedList(CSCE423),SinglyLinkedList(CSCE428),SinglyLinkedList(CSCE486),SinglyLinkedList(CSCE487)}; but
I'm trying to initialize string with iterators and something like this works: ifstream fin(tmp.txt);
I'm trying to initialize a variable called proxy like this: proxy = Savon::Client.new http://192.168.1.1:8080
I am trying to initialize a generic collection List something like this: List<MyCustomClass> myCustomClassList

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.