mdeg
Messages postés28Date d'inscriptionmercredi 31 mars 2010StatutMembreDernière intervention29 avril 2010
-
29 avril 2010 à 10:59
mdeg
Messages postés28Date d'inscriptionmercredi 31 mars 2010StatutMembreDernière intervention29 avril 2010
-
29 avril 2010 à 11:22
Bonjour,
J'ai deux procédures, dans la seconde procédure, à la fin je veux faire une boucle vers la première procédure mais à partir d'une certaine ligne (le début de la procédure ne doit pas être executé).
j'ai écrit ce code
Private Sub CommandButton_Supprimer_Click()
If ListBox_Points_Homologues.ListIndex = -1 Then
ListBox_Points_Homologues.RemoveItem (ListBox_Points_Homologues.ListCount - 1)
Else
ListBox_Points_Homologues.RemoveItem (ListBox_Points_Homologues.ListIndex)
End If
ListBox_Points_Homologues.ListIndex = -1
If ListBox_Points_Homologues.ListCount = 0 Then
CommandButton_Supprimer.Enabled = False
Else
CommandButton_Supprimer.Enabled = True
End If
CommandButton_Ouvrir_Click
End Sub
Mais là la procédure commandbutton_ouvrir_click commence au début. Est ce possible de commencer à une ligne définie qui se situe plus loin dans la procédure?
cs_DARKSIDIOUS
Messages postés15814Date d'inscriptionjeudi 8 août 2002StatutMembreDernière intervention 4 mars 2013130 29 avril 2010 à 11:14
Salut,
Non ce n'est pas possible facilement.
Mais vu le nom de ta fonction, il s'agit de l'événement click d'un bouton, donc voici ce que je te propose :
Public Sub SubEnCommun()
' mets ici le code à exécuter par un appel de procédure extérieur, par exemple :
ListBox_Points_Homologues.ListIndex = -1
If ListBox_Points_Homologues.ListCount = 0 Then
CommandButton_Supprimer.Enabled = False
Else
CommandButton_Supprimer.Enabled = True
End If
End Sub
Public Sub CommandButton_Ouvrir_Click()
' traitement spécifique, par exemple :
If ListBox_Points_Homologues.ListIndex = -1 Then
ListBox_Points_Homologues.RemoveItem (ListBox_Points_Homologues.ListCount - 1)
Else
ListBox_Points_Homologues.RemoveItem (ListBox_Points_Homologues.ListIndex)
End If
Call SubEnCommun() ' appel des traîtements en commun
End Sub
Et du coup, au lieu d'appeler CommandButton_Ouvrir_Click, appelle la sub SubEnCommun.
______________________________________
AVANT de poster votre message, veuillez lire, comprendre, et appliquer notre réglement