I try to use this code to fill attribute of map with my form but it dose not work?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim mxdoc As IMxDocument = My.ArcMap.Document
Dim pmap As IMap
pmap = mxdoc.FocusMap
Dim penumlayer As IEnumLayer = pmap.Layers
If pmap.LayerCount > 0 Then
Dim player As ILayer = penumlayer.Next
Do Until player Is Nothing
Dim pflayer As IFeatureLayer
If TypeOf player Is IFeatureLayer Then
pflayer = player
Dim pfclass As IFeatureClass = pflayer.FeatureClass
pfclass.Value(pfclass.Fields.FindField("TDate")) = TextBox1.Text
pfeature.Value(pfeature.Fields.FindField("Proj_Type")) = ComboBox1.Text
pfeature.Value(pfeature.Fields.FindField("Utility_Ty")) = ComboBox2.Text
pfeature.Value(pfeature.Fields.FindField("Destrict")) = ComboBox3.Text
pfeature.Value(pfeature.Fields.FindField("Team_No")) = ComboBox4.Text
End If
player = penumlayer.Next
Loop
Else
MsgBox("NO LAYERS")
End If
End Sub
Hornbydd
44.9k5 gold badges42 silver badges84 bronze badges
-
1What do you mean "it does not work"?user2856– user28562016年06月05日 12:01:08 +00:00Commented Jun 5, 2016 at 12:01
-
Thanks for answer me . the code be like this : pfeature.Value(pfeature.Fields.FindField("Team_No")) = ComboBox4.Text pfeature.Store() End If but also did not store any data in the feature classAIMEN– AIMEN2016年06月06日 06:54:16 +00:00Commented Jun 6, 2016 at 6:54
-
I mean that this code did not store the user data in the attribute of the feature classAIMEN– AIMEN2016年06月06日 07:05:25 +00:00Commented Jun 6, 2016 at 7:05
1 Answer 1
You need to commit the changes you have made to the dataset, currently your code is not doing that. All you need to do is call the store method.
So place after the last update and before the End If
the following line:
pfeature.store
answered Jun 5, 2016 at 16:14