[mapguide-users] Remove layer C#
Alex Fordyce
afordyce at ix.netcom.com
Wed Sep 5 18:06:21 EDT 2007
I'm to see if a layer exists and remove it if it exists. The layer would have
been saved as a temporary resource. Here is the code.
// get the map
MgMap map = new MgMap(siteConnection);
map.Open(mgMapName);
MgLayerCollection layerCol = map.GetLayers();
if(layerCol.Contains("myLayer"))
{
layerCol.Remove("myLayer");
}
.... Add myLayer code here .....
I get the following error whether or not the layer exists:
Compiler Error Message: CS1502: The best overloaded method match for
'OSGeo.MapGuide.MgLayerCollection.Remove(OSGeo.MapGuide.MgLayerBase)' has
some invalid arguments
Source Error:
Line 42: if(layerCol.Contains("myLayer"))
Line 43: {
Line 44: layerCol.Remove("myLayer");
Line 45: }
Line 46:
Anyone have any suggestions?
Thanks in advance.
alex
--
View this message in context: http://www.nabble.com/Remove-layer-C--tf4388428s16610.html#a12511956
Sent from the MapGuide Users mailing list archive at Nabble.com.
More information about the mapguide-users
mailing list