0

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
asked Jun 5, 2016 at 11:03
3
  • 1
    What do you mean "it does not work"? Commented 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 class Commented Jun 6, 2016 at 6:54
  • I mean that this code did not store the user data in the attribute of the feature class Commented Jun 6, 2016 at 7:05

1 Answer 1

3

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
1
  • the code be like this : Commented Jun 6, 2016 at 6:49

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.