Walk Lightly on this PLANET and yet leave such a FOOTPRINT that cannot be erased for thousands of Years..!!!
Visit Codstech for Cyber Security related Posts !

Visitors

Saturday, July 23, 2011

VB-55 : Displaying Day for a given date

Write an event procedure to display the day for a given date.

Refer Displaying Current Date and Time also.

(A)Program Design : 
To set Date, we need a controll called DtPicker.
To add DtPicker , select Project--> Components--> Microsoft Window common control-2.6.0




B) Property(Controls Used) :

  • 2 Labels (Label1,Label2) with Captions as Select Date and Day of the Date is
  • One Text Box (Name-Text1) for displaying the Day 
  • The control DtPicker (Name DtPicker1) near to label1 "Select Date"


(C) Attaching Code to the Object :
Private Sub DTPicker1_Change()
Select Case Weekday(DTPicker1)
Case 1: Text1.Text = "Sunday"
Case 2: Text1.Text = "Monday"
Case 3: Text1.Text = "Tuesday"
Case 4: Text1.Text = "Wednesday"
Case 5: Text1.Text = "Thursday"
Case 6: Text1.Text = "Friday"
Case 7: Text1.Text = "Saturday"
End Select
End Sub
Private Sub Form_Load()
DTPicker1_Change
End Sub


(D) Output :



24th  July-2011 is Sunday.

====================================================================
=========================================================