Dim bClic As Boolean Private Sub Command1_Click() Do DoEvents If bClic Then MsgBox "Bouton cliqué !" bClic = False End If Loop End Sub
Private Sub Command2_Click() bClic = True End Sub
-- Nicolas G.
FAQ VB : http://faq.vb.free.fr API Guide : http://www.allapi.net Google Groups : http://groups.google.fr/ MZ-Tools : http://www.mztools.com/
sam wrote:
Bonjour, peut-on à l'intérieur d'une boucle de traitement, tester si un autre bouton a été cliqué entre temps ?
(par exemple un bouton "arrêter" )
merci
Pascal B.
Dans la section "Declaration" de la form:
Dim StopBoucle As Boolean
Dans l'évenement Click du bouton:
StopBoucle = True
Dans ta boucle:
... StopBoucle = False For i=1 to 100 ... DoEvents If StopBoucle then Exit For Next i ...
Pascal
"sam" a écrit dans le message de news:11f301c3dff8$efd91290$ Bonjour, peut-on à l'intérieur d'une boucle de traitement, tester si un autre bouton a été cliqué entre temps ?
(par exemple un bouton "arrêter" )
merci
Dans la section "Declaration" de la form:
Dim StopBoucle As Boolean
Dans l'évenement Click du bouton:
StopBoucle = True
Dans ta boucle:
...
StopBoucle = False
For i=1 to 100
...
DoEvents
If StopBoucle then Exit For
Next i
...
Pascal
"sam" <s.petitseb@laposte.net> a écrit dans le message de
news:11f301c3dff8$efd91290$a101280a@phx.gbl...
Bonjour,
peut-on à l'intérieur d'une boucle de traitement, tester
si un autre bouton a été cliqué entre temps ?
... StopBoucle = False For i=1 to 100 ... DoEvents If StopBoucle then Exit For Next i ...
Pascal
"sam" a écrit dans le message de news:11f301c3dff8$efd91290$ Bonjour, peut-on à l'intérieur d'une boucle de traitement, tester si un autre bouton a été cliqué entre temps ?