BrianJBaldwin

Create Stand Alone Feature Class

Discussion created by BrianJBaldwin on Mar 1, 2013
Latest reply on Mar 4, 2013 by ldonahue
Hi All, I have a real beginner question here.

I am using this code from the Arc sample's, it is the CreateStandaloneFeatureClass.

Basically, what do I place in the OnClick Sub to call this function?  I have been doing a lot of reading and just ordered some books....but could use some help with this very basic concept. 

Thus far, I had my Sub with this code: CreateStandaloneFeatureClass(, "Test", , "Test")

Public Function CreateStandaloneFeatureClass(ByVal workspace As IWorkspace, ByVal featureClassName As String, ByVal fieldsCollection As IFields, ByVal shapeFieldName As String) As IFeatureClass
        Dim featureWorkspace As IFeatureWorkspace = CType(workspace, IFeatureWorkspace)
        Dim fcDesc As IFeatureClassDescription = New FeatureClassDescriptionClass()
        Dim ocDesc As IObjectClassDescription = CType(fcDesc, IObjectClassDescription)

        ' Use IFieldChecker to create a validated fields collection.
        Dim fieldChecker As IFieldChecker = New FieldCheckerClass()
        Dim enumFieldError As IEnumFieldError = Nothing
        Dim validatedFields As IFields = Nothing
        fieldChecker.ValidateWorkspace = workspace
        fieldChecker.Validate(fieldsCollection, enumFieldError, validatedFields)

        ' The enumFieldError enumerator can be inspected at this point to determine
        ' which fields were modified during validation.
        Dim featureClass As IFeatureClass = featureWorkspace.CreateFeatureClass(featureClassName, validatedFields, ocDesc.InstanceCLSID, ocDesc.ClassExtensionCLSID, esriFeatureType.esriFTSimple, shapeFieldName, "")
        Return featureClass
    End Function  

Outcomes