4

I am currently using the following method with ArcGIS 10 to open raster files from a form:

Public Function BrowseRaster(ByVal sTitle As String, ByRef sFolder As String, ByRef sName As String) As Boolean
 Dim pGxDialog As IGxDialog = New GxDialog
 Dim pRasterFilter As IGxObjectFilter = New GxFilterRasterDatasets()
 Dim pFilterCol As IGxObjectFilterCollection
 Dim pEnumGx As IEnumGxObject
 Dim pGxObject As IGxObject
 sFolder = ""
 sName = ""
 pFilterCol = pGxDialog
 pFilterCol.AddFilter(pRasterFilter, True)
 'pGxDialog.StartingLocation = ""
 pGxDialog.RememberLocation = True
 pGxDialog.AllowMultiSelect = False
 pGxDialog.Title = sTitle
 If pGxDialog.DoModalOpen(0, pEnumGx) Then
 pGxObject = pEnumGx.Next
 Dim sFile As New FileInfo(pGxObject.FullName)
 'sName = pGxObject.BaseName
 sName = pGxObject.Name
 sFolder = sFile.Directory.FullName
 Return True
 End If
End Function

How can I modify this function to also open files from inside of a file geodatabase?

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Apr 26, 2011 at 22:10
1
  • when you say "files" what do you mean? Do you mean feature classes? Commented Apr 27, 2011 at 16:00

2 Answers 2

4

Look at the very bottom of the list of objects that implement IGxObjectFilter

Create instances of RasterFormatFGDBFilter, RasterFormatPGDBFilter and RasterFormatSDEFilter and add them to your IGxObjectFilterCollection. This will enable Rasters inside GDBs. If you want to allow other FeatureClasses to be opened look at the list and also add those filters.

answered Apr 27, 2011 at 0:37
2
Dim pRasterFilter As IGxObjectFilter = New GxFilterRasterDatasets()

Just modify the filter. Look at IGxObjectFilter interface help for a list of available filters. For example to filter for Feeature Datasets you could use:

 Dim pGxDialog As IGxDialog
 Dim pGxObjFilter As IGxObjectFilter
 Dim pEnumGxObj As IEnumGxObject = Nothing
 pGxDialog = New GxDialog
 pGxObjFilter = New GxFilterFeatureDatasets
 pGxDialog.ObjectFilter = pGxObjFilter
 pGxDialog.Title = "Select a Dataset containing Feature Classes"
 pGxDialog.ButtonCaption = "OK"
 If pGxDialog.DoModalOpen(0, pEnumGxObj) Then
 pGxObj = pEnumGxObj.Next
 pGxDataset = pGxObj
 Me.txtDataset.Text = pGxObj.FullName
 Else
 Exit Sub
 End If
answered Apr 28, 2011 at 17:08
1
  • Is it possible to filter for specific (i.e. .xml) or custom (i.e. .lmnop) extensions, or are we limited to what is available in Catalog? Commented Mar 27, 2019 at 20:02

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.