Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Mar 19, 2012 04:25 PM by BrockAllen
Member
64 Points
52 Posts
Mar 19, 2012 04:11 PM|LINK
whats the problem with the following code, its giving me tough time for almost half a day.
if ((extImage != null)) { string[] ast_url = null; ast_url[0] = ""; ast_url[1] = ""; ast_url[2] = ""; ast_url[3] = ""; ast_url[4] = ""; for (int i = 0; i < 5; i++) { if (extImage[i] != null) { asset link = extImage[i]; ast_url[i] = link.url; } }
Participant
1081 Points
270 Posts
Mar 19, 2012 04:13 PM|LINK
Is it not compiling or is it not producing the correct result? It it hanging?
Mar 19, 2012 04:16 PM|LINK
its giving the following error
Object reference not set to an instance of an object.
When I remove the empty string assignments, then it gives another error of object refernce not set to an instance of an object
All-Star
27532 Points
4906 Posts
MVP
Mar 19, 2012 04:25 PM|LINK
Change:
string[] ast_url = null; to
string[] ast_url = new string[5];
mamoorkhan
Member
64 Points
52 Posts
Whats wrong with this for loop?
Mar 19, 2012 04:11 PM|LINK
whats the problem with the following code, its giving me tough time for almost half a day.
if ((extImage != null)) { string[] ast_url = null; ast_url[0] = ""; ast_url[1] = ""; ast_url[2] = ""; ast_url[3] = ""; ast_url[4] = ""; for (int i = 0; i < 5; i++) { if (extImage[i] != null) { asset link = extImage[i]; ast_url[i] = link.url; } }KenParkerJr
Participant
1081 Points
270 Posts
Re: Whats wrong with this for loop?
Mar 19, 2012 04:13 PM|LINK
Is it not compiling or is it not producing the correct result? It it hanging?
http://startingdotneprogramming.blogspot.com
mamoorkhan
Member
64 Points
52 Posts
Re: Whats wrong with this for loop?
Mar 19, 2012 04:16 PM|LINK
its giving the following error
Object reference not set to an instance of an object.
When I remove the empty string assignments, then it gives another error of object refernce not set to an instance of an object
BrockAllen
All-Star
27532 Points
4906 Posts
MVP
Re: Whats wrong with this for loop?
Mar 19, 2012 04:25 PM|LINK
Change:
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/