davelt99 Member Licensed User Longtime User Mar 1, 2013 #1 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
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 Mar 1, 2013 #2 davelt99 said: 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 Click to expand... B4X: Dim myMerchant as Merchant myMerchant = myMerchantList.Get(2) Log(myMerchant.City) Upvote 0
davelt99 said: 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 Click to expand... B4X: Dim myMerchant as Merchant myMerchant = myMerchantList.Get(2) Log(myMerchant.City)
stevel05 Expert Licensed User Longtime User Mar 1, 2013 #3 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: Mar 1, 2013 Upvote 0
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!
davelt99 Member Licensed User Longtime User Mar 1, 2013 #4 Thanks so much for the quick reply. Something simple but yet avoided me for hours. Thanks again. Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Mar 3, 2013 #5 Note that you can also write it this way: B4X: Dim MyType As Merchant = List.Get(i) Upvote 0