iOS Question Missing GetValueAt on MAP

Discussion in 'iOS Questions' started by Shay, Jan 25, 2015.

  1. Shay

    Shay Well-Known Member Licensed User

    This is from B4A, how do I do it on B4i, there is no GetValuteAt
    For i=0 To CityMap.Size-1
          City = CityMap.GetValueAt(i)
    If City.CompareTo(Main.MYCity) = 0 Then
           Main.MyCityCode = CityMap.GetKeyAt (i)
    Log("Got City Code")
           i = CityMap.Size - 
    End If
    stingrae likes this.
  2. Erel

    Erel Administrator Staff Member Licensed User

    See this link:
    Seems to me that you are not using the map correctly (or in the best way).

    If you need to look for a value then either switch the keys and values or use a second map that maps between the cities and the codes.

    However you can use this code:
    For Each CityCode As String in CityMap.Keys
    Dim City As String = CityMap.Get(CityCode)
    If City.CompareTo(Main.MyCity) = 0 Then
      Main.MyCityCode = CityCode
    End If
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice