I'm having trouble getting a value into an array. When debugging PM1 will have a value 1-15 I can see that.
But when it hits 2nd line MM1 never gets a value, in the 3rd line theres still no value and when i check dMain[0,1] it says 0.
If I change MM1 in the 3rd line to a number and check dMain[0,1] it has the same number!!!!!!
Where am I going wrong should this work?
With both MM1 & MP1 I have declared them at form level and tried in the method but nether seem to work Ahhhh
Is there an easer way to do this as I had done similar in VB but have deleted some of the project.
Any help any help would be greatly appreciated.
PM1 = randMain.Next(15);
int MM1 = Numbers[PM1] ;
dMain[0,1] = MM1;
return;
I've now shrunk it down to:
dMain[0,1] = Numbers[randMain.Next(15)];
But to no avail
Thanks in advance.
Mike.
VulpesPosted Apr 11, 2012, 2:58 PM
http://msdn.microsoft.com/en-us/library/zd1bc8e5.aspx
Where are you declaring the Numbers array or list? How big is it and are you sure you've populated it?
MIke LumleyPosted Apr 11, 2012, 3:51 PM
I bypassed populating it to do something else and forgot to put it back in the loop!!
Thank you so much Vulpes
for pointing that out, just spent 4 hours wondering why it was going wrong Ahhh.
I love thise C# so much nicer than VB. Been at it for 3 weeks now.
Thank you again, and for being so quick your a star.
Mike.
ps I've bookmarked that page to read tonight thanks