This article describes the use of VB to make the countdown program used in a module class code, is based on the console countdown program, can be used for VB beginners or VB Enthusiasts Reference learning, of course, the reader can also copy the code into the VB project directly use, but need to create their own relevant code, for beginners, It is also easy to read a piece of code.
The specific function code is as follows:
Module Module1 Sub Main () Dim A As Date Dim h, M, s as Integer Dim n, I as Long Dim x, Z As Long Dim y As Long Con Sole.
WriteLine ("This program is the countdown program, please division enter the number of hours to countdown, minutes, Seconds") Console.WriteLine ("Please enter the number of hours to be timed (integers greater than 0):") H = console.readline () Console.WriteLine ("Enter a total number of minutes (greater than or equal to 0 and less than 60 integers):") m = Console.ReadLine () Console.WriteLine () Enter the number of seconds to time (an integer greater than or equal to 0 and less than 60): "s = Console.ReadLine () Console.WriteLine (The current system is: {0}, h) A = Now () Console.WriteLine (" When The previous system time is: {0} ", a" Console.WriteLine ("") Console.WriteLine ("************** Countdown Start *****************") Console.WriteLine (
"************** Countdown Begins *****************") Console.WriteLine ("************** Countdown begins *****************") Console.WriteLine ("************** Countdown begins *****************") z = 0 x = for i = 0 to H * 3600 + M * + s for n = 0 to 6000000 for y = 0 to-Z = z + 1 Next next If (H <= 0) and (M <= 0) and (S <= 0) Then Exit for If s ; 0 Then s = s-1 Console.WriteLine ("Remaining: {0} hours {1} minutes {2} seconds", H, M, s) If (H ≪= 0) and (M <= 0) and (S <= 0) Then Console.WriteLine ("The countdown is complete, the random input character will exit the program:") Exit For End If if s = 0 Then if m > 0 Then m = m-1 s = Console.WriteLine ("Remaining: {0} hours {1} minutes {2} seconds", H, M, s) End If M = 0 and H > 0 and s = 0 Then h = h-1 m = N ' s = Console.WriteLine ("Remaining: {0} hours {1} minutes {2} seconds", H, M, s) If (H <= 0) and (M <=
0) and (S <= 0) Then Console.WriteLine ("Countdown completed, random input character will exit program:") Exit For End If End if Next console.read () End Sub End Module