Search Tools Links Login

[ If Statements, Weekend? ]


Visual Basic 6, or VB Classic

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 :)

Original Author: JamesJD

Inputs

Just place one Label into the form and just keep it's defalut name.

Returns

A message telling you if it is the weekend or not.

Code

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

About this post

Posted: 2003-06-01
By: ArchiveBot
Viewed: 92 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.