Hello Needed about array

sakamal

New member
Joined
Oct 13, 2009
Messages
2
Programming Experience
Beginner
Hello friends,

i need some help about array.

Array1 Array2 -output
--------------------------- ---------------------------
# Qty Rate # Qty Rate
1 10 50 1 35 50
2 20 80 2 20 80
3 15 50
4 10 50

i have array1 but am need array2
please guide me what am do ??
 
Instead of having array2 i would make a List. A List is basically an array but you can add and remove elements/indecies dynamically.

First declare your new list
VB.NET:
Dim array2 as new List (of ItemQty)

Then you would need to iterate over each item in the original array
VB.NET:
For Each Item as ItemQty in array1

End For

Inside that loop You need to decide if the current Rate has been calculated yet. You would do that by checking it against the array2 list. Once you have decided that the current Rate has not been calculated all you need to do is reiterate over the original array and sum up the Qty.
 
Hello rcombs4,

sorry am not understand


i need some help.

am using Structure for array

Structure ItemQty
Dim qty As Double
Dim rate As Double
End Structure

Dim array1(10) As ItemQty

array1(1).qty =txtQty1.text
array1(1).rate=txtRate1.text

array1(2).qty= txtqty2.text
array1(2).rate=textrate2.text
.......
......

Array1
---------------------------
# Qty Rate
1 10 50
2 20 80
3 15 50
4 10 50

i have above data in array

but now am want output in new array

output
---------------------------
# Qty Rate
1 35 50
2 20 80

please guide me what am do ??
if am use loop please tellme how may
please give me some code example
 
Back
Top