VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



If Statements, Weekend?

by JamesJD (11 Submissions)
Category: Math/Dates
Compatability: Visual Basic 5.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (6 Votes)

This will show beginners how to use simple If Statements why telling them if it's the weekend or not. Please leave your votes and comments :)

Inputs
Just place one Label into the form and just keep it's defalut name.
Code Returns
A message telling you if it is the weekend or not.

Rate If Statements, Weekend?

Private Sub Form_Load()
  If (Weekday(Now) = vbSaturday) Or (Weekday(Now) = vbSunday) Then
'This is the start of the If Statement telling the program that if it is
'Saturday or Sunday then print the message in Label1.
    Label1.Caption = "Don't worry it's only the weekend!"
'This is the message that will be printed in Label1.
  Else
'If the current date isn't Saturday or Sunday then it will go to the next message
'to print in Label1.
    Label1.Caption = "Ohh no it's...not the weekend!"
'This is the message that will be printed in Label1.
  End If
'This just ends the If Statement.
End Sub

Download this snippet    Add to My Saved Code

If Statements, Weekend? Comments

No comments have been posted about If Statements, Weekend?. Why not be the first to post a comment about If Statements, Weekend?.

Post your comment

Subject:
Message:
0/1000 characters