need help to pass values to array in for loop

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Mar 2009
Posts: 3
Reputation: A.kalyani is an unknown quantity at this point 
Solved Threads: 0
A.kalyani A.kalyani is offline Offline
Newbie Poster

need help to pass values to array in for loop

 
0
  #1
Mar 18th, 2009
can anyone please help me?

i have two decimal arrays l(15),r(15)
loop has to repeat for 16 times.l(15) , r(15) is the result i have to get.i wrote function F and it is executing perfectly.but atlast r(15) and l(15) is showing as system.decimal[].if i tested with ordinary variable other than array variable.its giving result.values are not passing to arrray


For b As Integer = 0 To 15
t = Decimal.Parse(r(b).ToString)
dim ta as decimal=Decimal.Parse(((l(b) And F(r(b)))).ToString)
'above line is working perfectly and its showing result.
r(b + 1) = Decimal.Parse(((l(b) And F(r(b)))).ToString)
'above line is not working.its giving result as system.deciamal[]
l(b + 1) = Decimal.Parse(t.ToString)
Next
Reply With Quote Quick reply to this message  
Join Date: Dec 2002
Posts: 461
Reputation: waynespangler is on a distinguished road 
Solved Threads: 56
waynespangler waynespangler is offline Offline
Posting Pro in Training

Re: need help to pass values to array in for loop

 
0
  #2
Mar 20th, 2009
First I don't know what F is returning. Is it a decimal?
Next you are converting a decimal to a string and then converting it back to a decimal. Big waste of resources. If F is returning a decimal then remove all Decimal.Parse.
  1. Dim r(15), l(15) As Decimal
  2. Dim t As Decimal
  3.  
  4. For b As Integer = 0 To 15
  5. t = r(b)
  6. Dim ta As Decimal = l(b) And F(r(b))
  7. r(b + 1) = l(b) And F(r(b))
  8. l(b + 1) = t
  9. Next
You are going to run into problems when b gets to 15 and try to set r(b+1) which is 16, You will get an index out of range error.
Wayne

It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 3
Reputation: A.kalyani is an unknown quantity at this point 
Solved Threads: 0
A.kalyani A.kalyani is offline Offline
Newbie Poster

Re: need help to pass values to array in for loop

 
0
  #3
Mar 20th, 2009
Thanks for ur help.
again another problem came in the code.for first round,its giving result but from 2nd round to 16th round,its giving same result. may be from second round,its taking 0s in l() and r().

i placed this form code in the following link.can you see and help me?
thanks in advance..
Download link: http://rapidshare.com/files/21151808...pplication.zip
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC