Hello Friends, today we learn how to make a program of "DATE OF BIRTH CALCULATION" in VISUAL BASIC 6.
Here you can see the design of the program. on the based of the design the coding will be prepared.
Design
Coding
Private Sub Command1_Click()
Dim d As Date, d1 As Date
d = Date
syear = Year(Date)
smonth = Month(Date)
sday = Day(Date)
Text2.Text = sday
Text3.Text = smonth
Text4.Text = syear
d1 = Format(Text1.Text, "dd/mm/yyyy")
cyear = Year(d1)
cmonth = Month(d1)
cday = Day(d1)
Text5.Text = cday
Text6.Text = cmonth
Text7.Text = cyear
If sday < cday Then
sday = sday + 30
d2 = sday - cday
m2 = cmonth + smonth + 1
Else
d2 = sday - cday
End If
If smonth < cmonth Then
smonth = smonth + 12
m2 = (smonth - cmonth)
cyear = cyear + 1
Else
m2 = smonth - cmonth
End If
Y2 = syear - cyear
Text8.Text = d2
Text9.Text = m2
Text10.Text = Y2
End Sub
Run the program or make exe what do you ever. you have to enter the date on the format (dd/mm/yyyy) and click on "Calculate" command button. Then you can see the current date which mean today's date and next you can see your date of birth once again and after if you can see your current age.
Thank You,
No comments:
Post a Comment