shrug-l: Add text to an attribute of a point from a text file.

Kevin L. Laird laikevin@co.walton.fl.us
Tue, 21 Jun 2005 16:26:59 -0500


A few months ago I submitted a request for help. Unfortunately no one on =
the list was able to help but several people were also interested in the =
problem.
Here is a small script that will do the following:
Request for file name and path (This will link to a text file with the =
information to be added to the points)
Wait for you to create a point using Editor in ArcMap V9.2=20
When Point is created it will assign text to the attribute field for the =
point.
This is set up for my use and you would be needed to change things to =
make it work for you.
Good Luck

Option Explicit
Private WithEvents EditEvent As Editor
Private sPinNumber As String
Private mChecked As Boolean
Private sFilename As String
Private mFileOpen As Boolean


Private Sub UIButtonControl1_Click()
    Dim pUID As New UID
   =20
    pUID.Value =3D "esriEditor.Editor"
   =20
    If (Not mChecked) Then
   =20
        ' Get File Name and Path for Parcel Numbers
       =20
        Set EditEvent =3D Application.FindExtensionByCLSID(pUID)
        sFilename =3D InputBox("Name and Path for File for PINS: ", "")
       =20
        ' Set Variables For File Name being entered and File Not Open =
Yet
       =20
        mChecked =3D True
        mFileOpen =3D False
       =20
    Else
   =20
        Set EditEvent =3D Nothing
        mChecked =3D False
       =20
    End If

End Sub

Private Sub EditEvent_OnCreateFeature(ByVal obj As IObject)

    Dim iFieldIndexText As Long
    Dim iFieldIndexClass As Long
    Dim iFieldIndexSymbol As Long
    Dim iFieldIndexSize As Long
    Dim pFeature As IFeature
    Dim sRecord As String
    Dim vAryRecord As Variant
    Dim sPointResult As String
       =20
    ' If file not open then open it
    If (Not mFileOpen) Then
        Open sFilename For Input As #1
        mFileOpen =3D True
    End If
   =20
   =20
    If TypeOf obj Is IFeature Then
        Set pFeature =3D obj
           =20
        ' Set Field Index Text to the number where the Parcel Number =
should be put
        iFieldIndexText =3D pFeature.Fields.FindField("GIS_FIG")

        ' If the Field Index exists and there are more parcels numbers =
in file then run if
        If (iFieldIndexText >=3D 0 And Not EOF(1)) Then
           =20
            ' Read first line of text file
            Line Input #1, sRecord
           =20
            ' set Parcel Number from file to PinNumber
            sPinNumber =3D sRecord
           =20
            ' display pin number
            MsgBox sPinNumber
           =20
            ' set Feature.Value for index # gotten above to string =
PinNumber
            pFeature.Value(iFieldIndexText) =3D Format(sPinNumber)
           =20
            ' Store data
            pFeature.Store
                                          =20
        End If
       =20
        If EOF(1) Then
            Close #1
            MsgBox "End of File"
            mFileOpen =3D False
        End If
       =20
    End If
   =20
End Sub

Kevin L. Laird
Gis Operator
Walton County Property Appraiser's Office
Phone: (850)892-8123
laikevin@co.walton.fl.us

--=20
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.7.9/23 - Release Date: 06/20/2005
=20