473,237 Members | 1,285 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,237 software developers and data experts.

Object reference question

AMP
Hello,
I have this procedure to convert a Multidimentional string array to an
int but I get an error on line 6
"Object reference not set to an instance of an object".But Ive created
my object on line 1
int i = 0;
1 uint[][] intArray = new uint[Sample.Length][];
2 for (i=0;i<(Sample.Length);i++)
3 {
4 for(int j=0;j<(Sample[i].Length);j++)
5 {
6 intArray[i][j]=UInt32.Parse(Sample[i]
[j],System.Globalization.NumberStyles.Integer);

}
}

What am I doing wrong?
Jun 27 '08 #1
4 946
"AMP" <am******@gmail.comwrote in message
news:11**********************************@i76g2000 hsf.googlegroups.com...
Hello,
I have this procedure to convert a Multidimentional string array to an
int but I get an error on line 6
"Object reference not set to an instance of an object".But Ive created
my object on line 1
int i = 0;
1 uint[][] intArray = new uint[Sample.Length][];
2 for (i=0;i<(Sample.Length);i++)
3 {
4 for(int j=0;j<(Sample[i].Length);j++)
5 {
6 intArray[i][j]=UInt32.Parse(Sample[i]
[j],System.Globalization.NumberStyles.Integer);

}
}

What am I doing wrong?
This isn't a multidimentional array its an array of arrays of uints.

Just before line 4 you need:-

intArray[i] = new uint[Sample[i].Length];

--
Anthony Jones - MVP ASP/ASP.NET
Jun 27 '08 #2
AMP
On Apr 25, 12:40*pm, "Anthony Jones" <A...@yadayadayada.comwrote:
"AMP" <ampel...@gmail.comwrote in message

news:11**********************************@i76g2000 hsf.googlegroups.com...


Hello,
I have this procedure to convert a Multidimentional string array to an
int but I get an error on line 6
"Object reference not set to an instance of an object".But Ive created
my object on line 1
* * * * * * * * *int i = 0;
* 1 * * * * * * uint[][] intArray = new uint[Sample.Length][];
* 2 * * * * * *for (i=0;i<(Sample.Length);i++)
* 3 * * * * * * * * {
* 4 * * * * * * * *for(int j=0;j<(Sample[i].Length);j++)
* 5 * * * * * * * {
* 6 * * * * * * * * * *intArray[i][j]=UInt32.Parse(Sample[i]
[j],System.Globalization.NumberStyles.Integer);
* * * * * * * *}
* * * * * * * *}
What am I doing wrong?

This isn't a multidimentional array its an array of arrays of uints.

Just before line 4 you need:-

intArray[i] = new uint[Sample[i].Length];

--
Anthony Jones - MVP ASP/ASP.NET- Hide quoted text -

- Show quoted text -
Perfect,
Thanks!!
Jun 27 '08 #3
On Fri, 25 Apr 2008 09:16:01 -0700, AMP <am******@gmail.comwrote:
Hello,
I have this procedure to convert a Multidimentional string array to an
int but I get an error on line 6
"Object reference not set to an instance of an object".But Ive created
my object on line 1
First of all, you presumably mean "on line 2". Secondly, all you've
created on line 2 is an array of arrays. Each individual array hasn't
itself been initialized yet, so when you try to index one with "j", you
get the error reported.

You need a new line between 3 and 4:

intArray[i] = new uint[Sample[i].Length];

I think that should fix your issue.

Pete
Jun 27 '08 #4
Peter Duniho wrote:
On Fri, 25 Apr 2008 09:16:01 -0700, AMP <am******@gmail.comwrote:
>Hello,
I have this procedure to convert a Multidimentional string array to an
int but I get an error on line 6
"Object reference not set to an instance of an object".But Ive created
my object on line 1

int i = 0;
1 uint[][] intArray = new uint[Sample.Length][];

First of all, you presumably mean "on line 2".
Real software engineers start counting at zero. ;)

Hilton
Jun 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Chris S. | last post by:
I'm trying to make a graphical editor and browser for Pickled files. One aspect I'm not sure about is how to detect multiple references to the same data. For instance, say I had the Pickled...
4
by: Mark D. Anderson | last post by:
About a month ago Richard Cornford did an interesting analysis of a memory leak in jscript (internet explorer) when there are "circular" references between DOM objects and (real) jscript objects:...
2
by: brazilnut52 | last post by:
I am going to outline the steps I go through to produce the problem. Hopefully this will help you understand the problem better I have created a simple COM DLL in .NET by using the COM class...
5
by: Michael Moreno | last post by:
Hello, In a class I have this code: public object Obj; If Obj is a COM object I would like to call in the Dispose() method the following code: ...
26
by: yb | last post by:
Hi, Is there a standard for the global 'window' object in browsers? For example, it supports methods such as setInterval and clearInterval, and several others. I know that w3c standardized...
17
by: Divick | last post by:
Hi, I am designing an API and the problem that I have is more of a design issue. In my API say I have a class A and B, as shown below class A{ public: void doSomethingWithB( B * b) { //do...
9
by: ziman137 | last post by:
Hi all, The results from following codes got me a bit confused. #include <stdio.h> #include <iostream> using namespace std; struct A {
2
by: Ralph | last post by:
Hi I don't understand why it's not working: function schedule(imTop){ this.tdImagesTop = imTop; } schedule.prototype.selectEl = function() { alert(this.tdImagesTop);
3
by: Eric Mahurin | last post by:
Is there a standard way to get a descriptor object for an arbitrary object attribute - independent of whether it uses the descriptor/ property protocol or not. I want some kind of...
275
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.