I have a Mapviewer in a WebPage that displays correctly but when I put similar code in a WebDialog it will not automatically recenter to the selected location when used in the SHOW event. The PIN/FLAG on the map is dropped at the correct location but it is not on the screen.
I put the EXACT same code into a “Refresh” button and it it works correctly in the same WebDialog. I added a delay (for testing) with app.CurrentThread.Sleep(2000) in the SHOW event thinking that maybe the process of displaying the dialog needed some additional time to finish but it still does not center.
Most of the code was “borrowed” from some examples.
Here is the code that works in the button but not the SHOW event. The Lat and Lon variables are properties of the WebDialog that I set before doing the SHOW for the dialog.
[code] 'Display the current client map as a dialog
Dim MapLoc as WebMapLocation
if Lat = 0 then
exit sub
end if
if MapLoc <> nil then
MapLoc.Visible = false
end if
'Tested the delay at this point in the code
MapLoc = New WebMapLocation(“Cincinnati, OH USA”)
MapLoc.Latitude = Lat
MapLoc.Longitude = Lon
MapViewer1.GoToLocation MapLoc
MapViewer1.AddLocation MapLoc
MapLoc.Visible = true
[/code]