Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Errors in arraylist

Status
Not open for further replies.

jadepatel

Technical User
Sep 4, 2002
35
0
0
GB
Hi,

I am having problems doin calculations on arraylists. I have 2 Arraylist......
1) MealTypeArrayList - contains a list of meals chosen by
a user.

2) MealQtyArrayList - contains the corresponding
quantities required. The index value directly relates
to the MealTypeArrayList index values

What im am trying to do is search my mealType Arraylist to see if the meal has already been previously chosen. If it does exist in this array i am retrieveing the index of this.

I then want to use this Index in my Meal Qty Arraylist so that i can add the new meal qty to the previously existing qty.
I think that am i getting errors in this addition part but i cannot see where im goin wrong.

This is the error i recieve:

This is the error that i get:
An unhandled exception of type 'System.MissingMemberException' occurred in microsoft.visualbasic.dll
Additional information: Public member 'add' on type 'Integer' not found.


This is my code i tried:
Dim ChosenMeal As String
ChosenMeal = CBoxMealName.Text.ToString
Dim Quantity As Integer
Quantity = CInt(txtMealQty.Text)
Dim MealTypeindex As Integer
Dim ExistingMealQty As Integer

MealTypeIndex = MealTypeArrayList.IndexOf(ChosenMeal)
ExistingMealQty = MealQtyArrayList(MealTypeindex)
ExistingMealQty = ExistingMealQty + Quantity
MealQtyArrayList.RemoveAt(MealTypeindex)
MealQtyArrayList(MealTypeindex).add(ExistingMealQty)


Can anyone plz help?






 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top