Dim num2 As Integer = (strArray.Length - 1)
Private Sub CmdOpenFeture_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdOpenFeture.Click Dim obj2 As IEnumGxObject Dim dialog As IGxDialog = New GxDialogClass Dim filters As IGxObjectFilterCollection = DirectCast(dialog, IGxObjectFilterCollection) Dim filter5 As IGxObjectFilter = New GxFilterTablesAndFeatureClassesClass Dim filter As IGxObjectFilter = New GxFilterPersonalGeodatabasesClass Dim filter2 As IGxObjectFilter = New GxFilterPGDBFeatureClassesClass Dim filter3 As IGxObjectFilter = New GxFilterPGDBFeatureDatasetsClass Dim filter4 As IGxObjectFilter = New GxFilterPGDBTablesClass filters.AddFilter(filter5, True) filters.AddFilter(filter, False) filters.AddFilter(filter3, False) filters.AddFilter(filter4, False) Dim dialog2 As IGxDialog = dialog dialog2.AllowMultiSelect = False dialog2.ButtonCaption = "Select" dialog2.Title = "Select Input File" Dim flag As Boolean = dialog2.DoModalOpen(0, obj2) dialog2 = Nothing If flag Then Dim strArray As String() Dim fullName As String = obj2.Next.FullName CboOpenfeature.Text = fullName InputDataCmd.readFieldFromFeature(fullName, (strArray)) CboFeaturefield.Items.Clear() Dim num2 As Integer = (strArray.Length - 1) Dim i As Integer = 0 Do While (i <= num2) CboFeaturefield.Items.Add(strArray(i)) i += 1 Loop TxtOutputPath.Text = (InputDataCmd.featureWorkspacePath & "\" & InputDataCmd.featureName & "_joined.shp") End If End Sub
Solved! Go to Solution.
Private Sub readFieldFromFeature(ByVal path As String, ByRef inputarray As String()) Try Dim factory As ESRI.ArcGIS.Geodatabase.IWorkspaceFactory = New ESRI.ArcGIS.DataSourcesFile.ShapefileWorkspaceFactory Dim workspace As ESRI.ArcGIS.Geodatabase.IFeatureWorkspace = DirectCast(factory.OpenFromFile(System.IO.Path.GetDirectoryName(path), 0), ESRI.ArcGIS.Geodatabase.IFeatureWorkspace) Dim fields As ESRI.ArcGIS.Geodatabase.IFields = workspace.OpenFeatureClass(System.IO.Path.GetFileNameWithoutExtension(path)).Fields Dim fieldcount As Integer = fields.FieldCount ReDim inputarray(fieldcount - 1) For i As Integer = 0 To fieldcount - 1 inputarray(i) = fields.Field(i).Name Next Catch ex As Exception MsgBox(ex.ToString) End Try End Sub
Dim strArray As String() If strArray Is Nothing Then MsgBox("Empty") Else Dim num2 As Integer = (strArray.Length - 1) End If
Dim strArray As String() Try Dim test As Integer = strArray.Length Catch ex As Exception MsgBox(ex.ToString) End Try
Private Sub readFieldFromFeature(ByVal path As String, ByRef inputarray As String()) Try Dim factory As ESRI.ArcGIS.Geodatabase.IWorkspaceFactory = New ESRI.ArcGIS.DataSourcesFile.ShapefileWorkspaceFactory Dim workspace As ESRI.ArcGIS.Geodatabase.IFeatureWorkspace = DirectCast(factory.OpenFromFile(System.IO.Path.GetDirectoryName(path), 0), ESRI.ArcGIS.Geodatabase.IFeatureWorkspace) Dim fields As ESRI.ArcGIS.Geodatabase.IFields = workspace.OpenFeatureClass(System.IO.Path.GetFileNameWithoutExtension(path)).Fields Dim fieldcount As Integer = fields.FieldCount ReDim inputarray(fieldcount - 1) For i As Integer = 0 To fieldcount - 1 inputarray(i) = fields.Field(i).Name Next Catch ex As Exception MsgBox(ex.ToString) End Try End Sub