11-02-2022, 10:36 PM
(This post was last modified: 11-02-2022, 11:24 PM by Kernelpanic.)
Quote:SMcNeill - Simple solution:
This solution is . . . smoother. But this: _Trim$(Str$(minute)) I have to take a good look at it again. Anyway, it took me some time to get your solution with Option _Explicit.
About _Limit: If I understood that correctly, then _Limit 5 does not correspond to reality. There _Limit 2 comes closer to reality.
Code: (Select All)
'Zeitanzeige. SMcNeill - 2. Nov. 2022
'Problem mit "Option _Explicit"
'Geloest mit "minute_str" als Dummy
Option _Explicit
Dim As Integer minute, sekunde
Dim As String minute_str, sekunde_str
sekunde = 0: minute = 0
Do
_Limit 5
Cls
sekunde = sekunde + 1
If sekunde > 59 Then
minute = minute + 1
sekunde = 0
End If
Locate 3, 4: Print "00.00"
'Minuten- und Sekundenzahl in String umwandeln
minute_str = Str$(minute)
sekunde_str = Str$(sekunde)
'Hier gab es Probleme mit den Integer-Variablen
'Str$(m) funktionierte nicht
minute_str = _Trim$(Str$(minute)): sekunde_str = _Trim$(Str$(sekunde))
Locate 3, 6 - Len(minute_str): Print minute_str
Locate 3, 9 - Len(sekunde_str): Print sekunde_str
_Display
Loop While minute < 2
End