Hi all,
I’m working on a project and decided to use array.pop and array.push but everytime i try to compile to test some code i get the following error:
“This Item does not exist: userSelectedCells.push Grid(x,y)”
for context here’s the entire method:
Sub SelectCell(x As Integer, y As Integer)
if selectedCount < 10 then
dim wasSelected As Boolean = false
dim selectedItem as Integer = -1
for i as integer = 0 to (selectedCount - 1)
if Grid(x,y) = userSelectedCells(i) then
wasSelected = true
selectedItem = i
exit for
end if
next
Grid(x,y).userSelected = not wasSelected
if wasSelected = false then
userSelectedCells.push Grid(x, y) // this is where i'm getting the error.
selectedCount = selectedCount + 1
else
userSelectedCells.remove selectedItem
selectedCount = selectedCount - 1
end if
end if
End Sub
userSelectedCells is a protected property of the class, and is defined as follows:
Protected userSelectedCells(-1) As GridCell
Any and all help would be appreciated.
Thanks and regards.