entering multiple addresses on a webmapviewer

Hi,

I want to add a variable number of location pins on a WebMapViewer.

I can create a number of webmaplocations but the number of addresses may change each time the map is loaded (taking customer visit locations from a database which will change over time).

What is the best way to declare the New webmalocations?

I have the code from the examples but not sure how to dim a variable number of locations.

Cheers,

Paul.

You could append them to an array declared without specified size (using -1 or nothing on declaration) when a map is loaded. Doing so wouldn’t specify the number of elements in the array and might be what you are looking for.

Hi Jason,

I have never used arrays before so tried -

Dim Location() As New WebMapLocation

But it gave aType mismatch error - Expect WebMapLocation() but got WebMapLocation

I also tried to redim after that incase Xojo was expecting to see it but still got the same error.

Paul

Dim locations() as webmaplocation

Dim loc as new webmaplocation.

Then use

Locations.append loc

Hi Greg,

Thanks, that stopped the errors but the following code only its the last location on the map:

Dim Locations() As WebMapLocation
Dim loc as new WebMapLocation

locationMap.MapType = 2
LocationMap.Zoom = 9

locations.Append loc
locations(0).Latitude = 51.3755190
locations(0).Longitude = 0.0167100
locations(0).Title = “Stevenson Heating Ltd”
LocationMap.AddLocation(Locations(0))

LocationMap.GoToLocation(locations(0))

locations.Append loc
locations(1).address = “237 Southlands Road, Bromley, BR1 2EG”
locations(1).Title = “A House”
locationMap.AddLocation(locations(1))

Am I missing something?

BTW I am just testing now and using the example included with Xojo as a reference.

Cheers,

Paul

Each time you start a new location, you need to put

Loc = new webmaplocation

Otherwise, they all refer to the same object in memory.

Greg,

All good and working.

Now onto the rest.

thanks for your help.

Paul