943,923 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 1286
  • VB.NET RSS
Mar 18th, 2009
0

need help to pass values to array in for loop

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
A.kalyani is offline Offline
3 posts
since Mar 2009
Mar 20th, 2009
0

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

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.
VB.NET Syntax (Toggle Plain Text)
  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.
Reputation Points: 84
Solved Threads: 58
Posting Pro in Training
waynespangler is offline Offline
461 posts
since Dec 2002
Mar 20th, 2009
0

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

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
A.kalyani is offline Offline
3 posts
since Mar 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Add a new tool permanently to toolbox
Next Thread in VB.NET Forum Timeline: How do I get around this DataGrid silliness?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC