1. Now I want to change label with help of select column from dropdown (drpField) and click to show label, it shows label, but old label is also there, I want to before display the current label old label should be clear.
2. If user don't want to show any label, that should be clear on map.
From your code snippet, it seems that you didn't modify old text style, you just kept the old text style untouched and added new text style, so the old style is still visible.
Please check the following solutions for your questions:
1. Now I want to change label with help of select column from dropdown (drpField) and click to show label
Find the old text style and modify "TextColumnName" property, then refresh the map.
2. If user don't want to show any label, that should be clear on map.
Reomve the old text style from "CustomStyles" collection.
Actually I trired to remove the custome style like below:
If Layer.ZoomLevelSet.ZoomLevel01.CustomStyles.Contains(CustomTextStyle) Then Layer.ZoomLevelSet.ZoomLevel01.CustomStyles.Remove(CustomTextStyle) End If
But the condition always returns false. So please brief above points with example, it will help me.
Although I don't know the detailed logic about your application, it should be convenient to modify this text style by using local variable as the follwing code.
1. Now my first point is resolved. Now I am able to change the current label. Now old label removed and new label coming. 2. Now, When I am trying to display map without any label, its not working for me.
Dim layer As FeatureLayer = WinformsMap1.FindFeatureLayer("WorldLayer") If layer.ZoomLevelSet.ZoomLevel01.CustomStyles.Contains(CustomTextStyle) Then layer.ZoomLevelSet.ZoomLevel01.CustomStyles.Remove(CustomTextStyle) End If layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20 Application.DoEvents() WinformsMap1.Refresh()
when I am cheking condition, it returns true, but label not removed from map.
I have tested the code snippet I provided in the previous post, it works for both updating and removing. So if you can provide us a self-contained sample to re-produce your issue, it will be helpful to find the root cause.