Const MAX_ARR_SIZE = 63 Public HouseholdCollection(MAX_ARR_SIZE, 2) As UInteger Const IDENTIFICATION_CODE = 0 Const MEMBER_COUNT = 1 Const INCOME = 2 Dim CurrentRecord As UInteger = 0
One of the functions/subroutines I'm using with the array is this:
Sub Delete(ByVal Household() As UInteger) Household(IDENTIFICATION_CODE) = 0 Household(MEMBER_COUNT) = 0 Household(INCOME) = 0 End Sub
The function/subroutine itself never has any problems, but its implementation raises the error. I implement it like this:
Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles btnDelete.Click If CurrentRecord > 0 Then CurrentRecord -= 1 End If LoadRecord(HouseholdCollection(CurrentRecord)) 'Another function very similar to Delete()' Delete(HouseholdCollection(CurrentRecord + 1)) End Sub
I've done all I can think of, including declaring the arguments as ParamArrays, but nothing worked.
Also, when using a For Each loop, I get Value of type 'UInteger' cannot be converted to '1-dimensional array of UInteger'.. I can use just a normal For loop, but I was curious as to why that would happen as well.
Dim IncomeSum As ULong
Dim ImpoverishedSum As UShort
For Each Item As UInteger() In HouseholdCollection If Item(IDENTIFICATION_CODE) = 0 Then Continue For End If RealRecordCount += 1 IncomeSum += Item(INCOME) If IsImpoverished(Item) Then ImpoverishedSum += 1 End If Next