List Items

davelt99

Member
Licensed User
Longtime User
I have a list that is being populated by a
Type Merchant(id as int,company as string,city as string)

I can't figure out how to get, for example, the city name from index 2 or the third row of the list.

Any help would be greatly appreciated.

Thank you
 

thedesolatesoul

Expert
Licensed User
Longtime User
I have a list that is being populated by a
Type Merchant(id as int,company as string,city as string)

I can't figure out how to get, for example, the city name from index 2 or the third row of the list.

Any help would be greatly appreciated.

Thank you

B4X:
Dim myMerchant as Merchant
myMerchant = myMerchantList.Get(2)
Log(myMerchant.City)
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
A list stores data as objects so you have to tell it how you want to treat the data.

You need to do

B4X:
Dim MyType As Merchant

MyType = Listname.get(index)

Then you can acces it as you would expect:

B4X:
MyType.company
etc.

[Edit] Beaten to it!
 
Last edited:
Upvote 0

davelt99

Member
Licensed User
Longtime User
Thanks so much for the quick reply. Something simple but yet avoided me for hours. Thanks again.
 
Upvote 0
Top