Results 1 to 2 of 2

Thread: .NET help

  1. #1
    Join Date
    Jan 2003

    .NET help

    I have the following code that uses Microsoft's MapPoint webservice to give me a location of a person's cell phone. Below is the code that gives me back the person's location. right now it displays a users username and domain. What I would like ti to show is the users first/last name. The variable p.Label is what is used to display this. Could someone help me write the code to iterate through my array of locatable contacts, performing a string compare of pr.DomainAlias to LocatableContact[i].DomainAlias. When I find the match, I then have to get the display name from there, and assign it to p.Label. Current code is below:

            If rbBuddy.Checked = True Then
                Dim myContacts() As LocatableContact
                myContacts = Session("myContacts")
                Dim li As ListItem
                Dim al As ArrayList = New ArrayList
                Dim cnt As Integer = -1
                For Each li In lstBuddies.Items
                    cnt = cnt + 1
                    If li.Selected = True Then
                    End If
                Dim users(al.Count - 1) As String
                users = al.ToArray(GetType(String))
                    posResults = locService.GetPositions(users)
                    If posResults.PositionsFound <= 0 Then
                        lblMessage.Text = "Problem finding."
                        Dim pr As Position
                        Dim local As New ArrayList
                        Dim l As Location = New Location
                        For Each pr In posResults.Positions
                            If pr.ResultCode = PositionResultCode.Succeeded Then
                                Dim p As New Pushpin
                                p.Label = pr.DomainAlias
                                p.LatLong = pr.LatLong
                                'p.IconDataSource = "MapPoint.Icons"
                                'p.IconName = "152"
                                'prgjr1 - use our custom icons
                                p.IconDataSource = "Rite_Aid.8792"
                                p.IconName = "mobile_phone"
                                p.PinID = "pinid"
                                l = New Location
                                l.LatLong = New LatLong
                                l.LatLong = pr.LatLong
                            End If
                        lblMessage.Text = "Found Location!"
                        Dim myRenderService As New RenderServiceSoap
                        myRenderService = Session("myRenderService")
                        Dim ds As String
                        ds = lstDatasource.SelectedValue
                        mv = myRenderService.GetBestMapView( _
                            local.ToArray(GetType(Location)), ds).ByHeightWidth
                        'mv.CenterPoint = posResults.Positions(0).LatLong
                        'mv.Height = 1.0
                        'mv.Width = 1.0
                        'lstZoom.SelectedIndex = 2
                    End If
                Catch ex As Exception
                    lblMessage.Text = "Error Finding Buddies. Try again in a few minutes." '& ex.ToString
                End Try
            End If

  2. #2
    Join Date
    Nov 2002
    Auburn, AL
    i would just say a for loop and then an if statement inside of it that would compare. The counting variable for the loop you would use for the array index of course. I will have to really look at your code to figue out all of the vars but I mean it will look like this
    Dim i As Integer
    For i = 0 to thearray.Length-1
         if thearray(i) = yourstring then
             yourlbl.text = "the index is" & thearray(i)
         end if

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center