salut
j'ai une petite application qui contient un stopwatch,
quand je clique sur F6 le chronométre se déclenche, sur F7 s'arrête et f8 me donne la duréé
le probléme est que la duréé est toujours 00:00 et je sais pas pourquoi
voila mon code:
j'ai essayé ça aussi
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 dim a as stopwatch public sub1 ........ if e.keycode = keys.F6 a.start() end if if e.keycode = keys.F7 a.stop() end if if e3keycode = keys.F8 r = a.elapsed() end if
Remarque : j'ai importé system.diagnostic
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 dim a as stop watch public sub 1 ........ if e.keycode = keys.F6 a.start() end if end sub public sub2 .......... if e.keycode = keys.F7 a.stop() end if end sub public sub3 ...... if e.keycode = keys.F8 r = a.elapsed() end if end sub
quand je passe en mode débug détaillé le chrono se déclanche
et il s'arréte et je sais pas pourquoi la duree est null
SVP aidez moi
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 imports system.diagnostic public class form1 dim a as new stopwatch dim r as string public sub form1_keydown ( byval sender as object, byval e as system.windows.forms.keyeventargs) handles me.keydown if e.keycode = keys.F6 then a.start() end if end sub public sub form11_keydown ( byval sender as object, byval e as system.windows.forms.keyeventargs) handles me.keydown if e.keycode = keys.F7 then a.stop() end if end sub public sub form111_keydown ( byval sender as object, byval e as system.windows.forms.keyeventargs) handles me.keydown if e3keycode = keys.F8 then r = a.elapsed.tostring() end if end sub end class
merci
Partager