shiva_gis

GDB_Browser Form

Discussion created by shiva_gis on May 4, 2011
Latest reply on May 9, 2011 by shiva_gis
Greetings,

Can some one help me with required corrections to my code.

I want to design a form with 4 listboxs. Listbox1 displays Dataset name, Listbox2 displays FC list of selected dataset,Listbox3 with Field names of selected FC and Listbox4 -unique values of selected field. Also Intend to create some command buttons.

1. Unable to get all the dataset names in listbox1(there are total of 6 DS)
2. Code lines to get the list in Listbox2 from selected item of Listbox1.

Code in halfway:


Private Sub UserForm_Initialize()


    Dim pMxdoc As IMxDocument
    Dim pApp As IApplication
    Set pApp = application
    Set pMxdoc = pApp.Document
    Dim pLayer As ILayer
    Dim pDataLayer As IDataLayer
    Dim pDatasetName As IDatasetName
    Dim pWSName As IWorkspaceName
    Dim sFDS As String
    Dim pFCName As IFeatureClassName
    Dim i As Integer
     Dim j As Integer
    For i = 0 To pMxdoc.FocusMap.LayerCount - 1
        Set pLayer = pMxdoc.FocusMap.layer(i)
        If TypeOf pLayer Is IDataLayer Then
            'sFDS = ""
           
           
            Set pDataLayer = pMxdoc.FocusMap.layer(i)
            Set pDatasetName = pDataLayer.DataSourceName
            Set pWSName = pDatasetName.WorkspaceName
           
           
            If TypeOf pDatasetName Is IFeatureClassName Then
            Set pFCName = pDatasetName
            If Not pFCName.FeatureDatasetName Is Nothing Then
            sFDS = pFCName.FeatureDatasetName.name
            End If
            End If
           
                   
           For j = 0 To ListBox1.ListCount - 1
           If ListBox1.List(j) = pFCName.FeatureDatasetName.name Then
           bDuplicate = True
           End If
           Next
           If bDuplicate = False Then
        ListBox1.AddItem sFDS

Dim pUID As New UID
pUID = "{E156D7E5-22AF-11D3-9F99-00C04F6BC78E}" 'IGeoFeatureLayer IID
Dim pEnumLayer As IEnumLayer
Set pEnumLayer = pMxdoc.FocusMap.Layers(pUID, True)


Set pDataLayer = pEnumLayer.Next

           End If
          
           'ListBox1.AddItem sFDS
           ListBox2.AddItem pDatasetName.name
End If
Next i




Thanks in advance.
shiva

Attachments

Outcomes