List.Get(n).? not possible?

enonod

Well-Known Member
Licensed User
Longtime User
I am trying to check a list to see if a particular instance of a Type, of many in the list, is present.
If I do the following...

Type Coords(X as Byte, Y as Byte)
...
Dim positions as List
Dim posn as Coords
...
posn.X=10 : posnY=15

positions.InsertAt(5, posn)

why can I not...

If positions.Get(5).X = 10 then
 

stevel05

Expert
Licensed User
Longtime User
You need to assign the contents to a temp variable of the correct type.

Dim temp as Coords
temp = positions.get(5)

if temp.x = 10 then
 
Upvote 0

enonod

Well-Known Member
Licensed User
Longtime User
Thank you stevel05, I understand that of course, but do not understand why I cannot do as I attempted inline because...

positions.Get(5)

refers to an Object

I would expect to do as I suggested.
 
Upvote 0

enonod

Well-Known Member
Licensed User
Longtime User
Very reasonable thanks stevel05.
 
Upvote 0
Top