Folder Browser Dialog (Is there any such thing as a Dataset Browser Dialog?)

1820
6
Jump to solution
04-19-2012 11:54 AM
USFS_AGOLAdministrator
New Contributor III
Hi,

I have written code to allow my users to click a button, and the folder browser dialog opens, allowing them to navigate to a  desired folder to save the output of an eliminate operation.  My users want to be able to browse to a dataset, and save the results inside of a dataset.  The folder browser dialog does not display datasets.  I am using VB.Net 2008, and I don't see anything in the toolbox that would allow me to browse datasets in a folder.  I'm sure it can be done, but how?  Any help would be greatly appreciated!
0 Kudos
1 Solution

Accepted Solutions
AlexanderGray
Occasional Contributor III
Yes, the GXDialog can do that.  You need to set its object filters and show with open or save.

View solution in original post

0 Kudos
6 Replies
AlexanderGray
Occasional Contributor III
Yes, the GXDialog can do that.  You need to set its object filters and show with open or save.
0 Kudos
USFS_AGOLAdministrator
New Contributor III
Awesome, I'll give that a try, thanks for the reply
0 Kudos
AlexanderGray
Occasional Contributor III
no problem, just mark it as answered if it works
0 Kudos
USFS_AGOLAdministrator
New Contributor III
Here is the code for this.  It is allowing me to navigate and see the different .gdb's and feature datasets, but when I click on the dataset that I want to save my new layer into, it only saves it to the geodatabase, not to the feature dataset.  The last line of this code (FinalLocation.FullName), returns the pathname to the gdb, not the dataset, even though I have selected the dataset in the dialog.  I need to have it return the dataset name in the path as well, so the new layer will be saved in the dataset, not the gdb.  Any ideas?




    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim gxdial As IGxDialog = New GxDialog
        Dim gxobjfilter As IGxObjectFilter = New GxFilterDatasets

        gxdial.ObjectFilter = gxobjfilter

        Dim gxEnum As IEnumGxObject = Nothing

        If Not gxdial.DoModalOpen(0, gxEnum) Then
            Exit Sub
        End If

        gxdial.RememberLocation = True

        Me.txtOutputPath.Text = gxdial.FinalLocation.FullName

    End Sub
0 Kudos
NeilClemmons
Regular Contributor III
When you call DoModalOpen, the selected item(s) are returned in the IEnumGxObject reference that you pass into the method.  However, since you are using the dialog to browse to a Save location then you should be calling DoModalSave instead of DoModalOpen.  It's been a while since I've used this dialog for saving things but if I remember right, you have to build the full path by combining the FinalLocation property and the Name property.  I could be wrong on that though.
0 Kudos
AlexanderGray
Occasional Contributor III
the enumGxObject has the object or objects you selected
Dim gxobj As IGxObject = gxEnum.Next
Debug.WriteLine(gxobj.FullName)

FullName has the whole path with the directory gdb and dataset.
0 Kudos