Pour y arriver, lorsque j'initialise le formulaire, je prends les données de la feuille et les mets dans un tableau
Mais ou je bloque, c'est comment écrire dans le code du combobox d'aller chercher et d'afficher les données de mon tableau créé plus tôt
et d'afficher les données de mon tableau
Public Function charger_intersection() As t_intersection()
Dim i As Integer
Dim nb_lignes As Integer
Dim ligne As Integer
Dim temp() As t_intersection
nb_lignes = nb_ligne
ReDim temp(nb_lignes) As t_intersection
For i = 1 To nb_lignes
ligne = i + TAILLE_ENTETE
temp(i) = m_intersection.creer_intersection(Cells _
(ligne, COLONE_ID).Value, _
creer_point(Cells(ligne, COLONE_X).Value, _
Cells(ligne, COLONE_Y).Value), _
Cells(ligne, COLONE_NOM).Value)
Next i
charger_intersection = temp
End Function
Private Sub UserForm_Initialize()
Dim tableau_intersections() As t_intersection
tableau_intersections() = bd_intersections.charger_intersection()
cb_depart.List = tableau_intersections.nom
cb_destination.List = tableau_intersections.nom
End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questiont_intersecion, comme je l'ai dit, est un type special que j'ai declare dans un module m_intersection
nb_ligne etait simplement pour savoir combien de ligne mon tableau allait contenir, je crois que j'ai oublie de la definir ou de l'enlever. Pas important pour l'instant
Private Sub UserForm_Initialize()
With ComboBox1
derlig = Worksheets("titi").Range("A" & Rows.Count).End(xlUp).Row
.ColumnCount = 4
.ColumnHeads = True
.RowSource = "titi!A2:D" & derlig
End With
End Sub