14. Write a VB program to display age in year, month, days, hours, minutes, seconds.


Private Sub cmdClear_Click()
Text1.Text = “”
Text2.Text = “”
Text1.SetFocus
End Sub

Private Sub cmdDisplay_Click()
Dim b As Date
Dim d As Date
Dim age As Date
b = Text1.Text
d = Format$(Now, “dd/mm/yyyy hh:mm:ss “)
age = Format$(d – b, “dd/mm/yyyy hh:mm:ss”)

Text2.Text = Year(age)
Text3.Text = Month(age)
Text4.Text = Day(age)
Text5.Text = Hour(age)
Text6.Text = Minute(age)
Text7.Text = Second(age)
End Sub

Private Sub cmdExit_Click()
Unload Me
End Sub

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s