banniere

Le portail francophone de la géomatique


Toujours pas inscrit ? Mot de passe oublié ?
Nom d'utilisateur    Mot de passe              Toujours pas inscrit ?   Mot de passe oublié ?

Annonce

#1 Thu 17 May 2007 02:18

aziz_emi
Participant occasionnel
Date d'inscription: 4 May 2007
Messages: 11

afficher les valeur d'un champ pours les entité d'une couche

salut tt le monde
je ve afficher les waleurs d'un champ dans une combobox , j essai avec le code suivant mai ca marche pas
s 'il ya klk un ki peut me 'aider ?
merci d'avance
le code et le suivent



Private Sub lboxChamp_Click()
Dim pMxDoc As IMxDocument
Dim pMap As IMap
Dim pLayers As IEnumLayer
Dim pLayer As ILayer
Dim pFLayer As IFeatureLayer
Dim pFClass As IFeatureClass

Dim i As Integer

'Dim pFCursor As IFeatureCursor
Dim pFeature As IFeature
Dim NbChamps As Integer
Dim NBentites As Integer
Set pMxDoc = ThisDocument
Set pMap = pMxDoc.FocusMap
Set pLayers = pMap.Layers

Set pLayer = pLayers.Next

Do While Not pLayer Is Nothing
    If pLayer.Name = lboxCouche.Value Then
    Dim pFields As IFields
    Dim pField As IField
    Dim pMField As IField
    Set pFLayer = pLayer
    Set pFClass = pFLayer.FeatureClass
    Set pFields = pFClass.Fields
    Set pField = pFields
    Do While Not pField Is Nothing
        If pField.Name = lboxChamp.Value Then
            Set pMField = pField
            Set pFLayer = pLayer
            Set pFClass = pFLayer.FeatureClass
            Set pFeature = pFClass.GetFeature
            NBentites = pFeature.Count
            With pMField
                For i = 0 To (NBentites - 1)
                    Debug.Print "        - " & pFeature(i).Value(pMField)
                   
                            lboxAttribut.AddItem pFeature(i).Value(pMField)
                Next i
            End With
            If Not pFeature Is Nothing Then
                MsgBox "Il n'y a ps de champs. Choissez une autre couche"
            End If
        End If
       
       
        Set pFClass = Nothing
        Set pFLayer = Nothing
       
        Set pLayer = Nothing
    Else
        Set pLayer = pLayers.Next
    End If
Loop

Set pLayers = Nothing
Set pMap = Nothing
Set pMxDoc = Nothing

End Sub

Hors ligne

 

Pied de page des forums

Powered by FluxBB