1
Vote

Pushpin labels

description

Hi,
i have noticed that when i add multiple pushpins to a map (i.e by looping through records from a datatable), every pushpin has the label details of the last entry, despite placing the pins in the correct locations.
 
I have chedcked this over and over and can confirm that each pushpin label is set to contain the unique texts. Please help.
 
PS: i have code dumped my routine below:
 
List<SearchLocation> locations = new List<SearchLocation>();
        try
        {
            string imageLocation = string.Empty;
            //
            int count = (cmbNo.SelectedItem.ToString() == "All") ? 1000: int.Parse(cmbNo.SelectedItem.ToString());
 
            foreach (DataRow dr in dt.Rows.Cast<System.Data.DataRow>().Take(count))
            {
                locations = new List<SearchLocation>();
                SearchLocation a = new SearchLocation();
 
                a.PushPinLayer = layer;
                a.PushPinDescription = dr["Address"].ToString().Trim();
                a.PushPinTitle = dr["Name"].ToString().Trim();
                a.Where = dr["postcode"].ToString();
                a.Longitude = !string.IsNullOrEmpty(dr["Long"].ToString()) ? double.Parse(dr["Long"].ToString().Trim()) : 0.0;
                a.Latitude = !string.IsNullOrEmpty(dr["Lat"].ToString())   ? double.Parse(dr["Lat"].ToString().Trim())  : 0.0;
 
                if (a.Latitude > 0.0 && a.Longitude > 0.0)
                    a.Where = string.Empty;
                else
                    a.Where = dr["postcode"].ToString().Trim();
 
                a.PushPinImage = imageLocation;
 
                locations.Add(a);
                ucVEarth1.VE_FindLocations(locations, true, true, null);
                Application.DoEvents();
            }
            ucVEarth1.VE_SetZoomLevel(12);

comments