Null Reference Exception problem

Posts 1–8 of 8 · Page 1 of 1
Null Reference Exception problem
Hi everybody.

I'm making a project with Arduino and I need to store a lot of values in a array of doubles.

The declaration of this array is this one:
Code:
Dim array()() As Double
When I try to ReDim it I got this error:





Of course, if I don't use ReDim, it gives me the same error when I try to populate it.


Imho, there's no sense in this error .-.


Any suggestion?
Try initially declaring the array with a size of (0) ? ..that'll give it 1 item and might get rid of the exception.
Code:
Dim array(0)(0) As Double
I haven't messed with multi-dimensional arrays.
Leaving for work right now sry, hope that helps, else will try again tonight.
Quote Originally Posted by abuckau907 View Post
Try initially declaring the array with a size of (0) ? ..that'll give it 1 item and might get rid of the exception.
Code:
Dim array(0)(0) As Double
I haven't messed with multi-dimensional arrays.
Leaving for work right now sry, hope that helps, else will try again tonight.
If I try to declare it with both dimension it says me that I can only declare the first one. I mean, I can only do this:
Code:
Dim array(0)() as Double
multi dimensions.... umm...
I/m probably wrong.... but....

within VB dont you declare it as for example:
Code:
dim array(0, 0) as integer
like.... I don't think I'm meant to be saying this as I'm probably in the wrong...
but that's the way i made my calender... using
Code:
Date(intDays, intMonth, intYear)
Quote Originally Posted by utherson601 View Post
multi dimensions.... umm...
I/m probably wrong.... but....

within VB dont you declare it as for example:
Code:
dim array(0, 0) as integer
like.... I don't think I'm meant to be saying this as I'm probably in the wrong...
but that's the way i made my calender... using
Code:
Date(intDays, intMonth, intYear)
As I told before, you can't declare the array and give the dimension at the same time. You need to use ReDim for multi-dim.
Quote Originally Posted by Sixx93 View Post
As I told before, you can't declare the array and give the dimension at the same time. You need to use ReDim for multi-dim.
What you are declaring is not a multidimensional array, its a jagged array.
what i declared was a multidimensional array.
MINE will work.

Resource

Jagged Array Usage
Quote Originally Posted by Sixx93 View Post
..
utherson601 was right about the syntax:



Works for me.
Ok, thanks to all, I'll try it shortly.

Edit:
Seems to work. Thanks!
Posts 1–8 of 8 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?