Results 1 to 3 of 3

Thread: MD Arrays

  1. #1

    Thread Starter
    Fanatic Member carlblanchard's Avatar
    Join Date
    Sep 2003
    Location
    Bournemouth (UK)
    Posts
    539

    MD Arrays

    Hey All trying to do a multidimenison array but getting this error

    An unhandled exception of type 'System.NullReferenceException' occurred in CompaniesHouseScanner.exe

    Additional information: Object reference not set to an instance of an object.

    Can you nice people help....


    VB Code:
    1. Dim KeyArray(,) As String
    2. Dim i As Integer
    3.  
    4.         KeyArray(0, 0) = ("Office :")
    5.         KeyArray(0, 1) = ("Status :")
    6.         KeyArray(1, 0) = ("status :")
    7.         KeyArray(1, 1) = ("Company No")
    8.  
    9. For i = 0 To 1
    10.  
    11. msgbox(KeyArray(i, 1))
    12.  
    13. next
    I am curretly building a defect management system for software and web developers,
    If you wana try it out (beta test) and keep it for free just send me a message

  2. #2
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840
    Hi.

    If you plan to fill the array manually as you do in your code, you have to set the size of the dimensions when declaring the variable.

    e.g. Dim KeyArray(123,321) As String

    Multidimensional arrays are not dynamic, and you can't use redim, so you would have to know the size before entering data.

    Correct me if I'm wrong, folks...
    I wish I could think of something witty to put in my sig...

    ...Currently using VS2013...

  3. #3

    Thread Starter
    Fanatic Member carlblanchard's Avatar
    Join Date
    Sep 2003
    Location
    Bournemouth (UK)
    Posts
    539

    RESOLVED

    it was simply the case that i was defining the size of the array. I knew the size was going to be x so it was simply a case of redim KeyArray(10,1)

    nice thanks for replying
    I am curretly building a defect management system for software and web developers,
    If you wana try it out (beta test) and keep it for free just send me a message

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width