To exhibit what is the day when the second command button is clicked and to clear the screen when the first command button is clicked. The functioning of this program is given in figure:
1) Handle the click event for the first command button.
2) Handle the click event for the second command button.
3) The Cls method clears the form.
4) Type the below coding in the first command button event handler.
Private Sub Command1_Click()
5) Type the below coding in the second command button event handler.
Private Sub Command2_Click()
Select Case Weekday(Now)
Figure: The Resultant of clicking the command button and caption week day
The function Weekday returns the present day. If the day is Sunday vbSunday would be returned. And hence, the corresponding block would execute. Therefore the Sunday would be displayed on the screen. The Select Case and End Select denote the block.