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?
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?