Issue with Removing Last Layer From Map

Topics: WinForms Controls
Mar 25, 2015 at 8:02 AM
Hi Team,
As i face a minor problem in Removing Layers on Map.
As we have 2 Layer on Map when i remove a Layer it removes successfully but when my map has only one Layer and when i am going to remove that layer from map it cant be removed but on behind it removed from memory and when i change the zoom of map it disappears.
My Code to Remove Layer is:-
ILayer lyr = mapBox1.Map.Layers[LayerName];
mapBox1.Map.Layers.Remove(lyr);
mapBox1.Refresh();
Regards,
Sgoyal.