Today with a new lesson from Visual Basic and explanation of the tool Timer
Timer tool most important tools for Visual Basic is a tool to control the time
The most important characteristics of Timer is a tool characteristic interval which placed the time values to be the work tool
In 1000 this tool means s feat we want to write hours will be 3600000, and so on
Work program to display the date and time
2 label established one of history and the other time and clear inside them from the property caption
Drag the tool timer and placed on molds and does not control in the form because it does not appear during the presentation of the program
Click on the timer tool and type inside this code
Label1.Caption = Time
Label2.Caption = Date
To be the final code so
Private Sub Timer1_Timer ()
Label1.Caption = Time
Label2.Caption = Date
End Sub
Explain code
Label1.caption is what displays in label1 The tool chosen Time at which time
Label2.caption is what displays in label2 The tool chosen Date which is the date
Now press the Timer tool and go to properties and Mark interval values equal to 100
Now press F5 to see the program
To save the project
1_ to save the project permanently without amendment it from the top of the program select File
Then Make project exe
2 - to save the project to modify it later
Select Fie then Save project as
Work program to close the program, which operates it after a certain time
Open Visual
Place the timer click on it twice
Put inside this code
End
To be the final code
Private Sub Timer1_Timer ()
End
End Sub
The code is very easy to get out of the program
Is characteristic of tool ntervsl to 5000
For example, his 5000 no 5 seconds
Press F5 and try the program
0 التعليقات:
إرسال تعليق