VB.NET Worksheet
Visual Basic Tasks 2 Task 1:
Create a stopwatch -
•
Create a basic interface with a timer, a label and two buttons
•
Change the name properties of each using appropriate naming conventions
•
Change the text properties of the buttons to “Go” and “Stop”
•
Set the timer interval property to 1000
•
Create a variable at the top of the code page
to store the number of seconds passing
Dim VariableName as DataType
Remember to use the appropriate prefix for your variable name
•
Double-click on the timer object to create an event (subprogram)
•
In the timer subprogram, increment the value of the variable you are using to store thenumber of seconds passing
•
Display the number of seconds in the label
•
In the
GO
button, set the timer enabled property to True
tmrTimerName.Enables = True
•
In the
STOP
button, set the timer enabled property to False
Task 2:
Count the minutes -
•
Adjust your stopwatch to count minutes and seconds. Have a go at this one on your own.Plan what you need to change in the program.
Task 3:
Hit Game –
•
Create a basic interface with multiple picture boxes & two timers
•
Change the name properties of each using appropriate naming conventions; one timer should be the SHOW timer, the other should be the HIDE timer
•
Change the background colour of the picture boxes
•
Set the intervals of the timers to different values (minimum 1000)
•
Create a score variable at the top of the code page
•
Initialise the value of the score variable to zero
Double-click on the form to create a form load
1
Below
InheritsSystem.Windows.Forms.Form
Page 1 of 2
Add a Comment