Create a form having three radio buttons for age in year, age in days
and age in months. Enter date of birth in a textbox and display
appropriate result in another textbox. Also find date of death (assume
average age of 62).
Public Class app3vb
Dim dt, t As Date
Private Sub app3vb_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox2.Clear()
TextBox3.Clear()
End Sub
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
t = Today
If TextBox1.Text <> "" Then
dt = CDate(TextBox1.Text)
End If
If RadioButton1.Checked = True Then
TextBox2.Text = DateDiff(DateInterval.Year, dt, t) & " Year"
TextBox3.Text = DateAdd(DateInterval.Year, 62, dt)
End If
End Sub
Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
t = Today
If TextBox1.Text <> "" Then
dt = CDate(TextBox1.Text)
End If
If RadioButton2.Checked = True Then
TextBox2.Text = DateDiff(DateInterval.Day, dt, t) & " Days"
TextBox3.Text = DateAdd(DateInterval.Day, 62, dt)
End If
End Sub
Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
t = Today
If TextBox1.Text <> "" Then
dt = CDate(TextBox1.Text)
End If
If RadioButton3.Checked = True Then
TextBox2.Text = DateDiff(DateInterval.Month, dt, t) & " Month"
TextBox3.Text = DateAdd(DateInterval.Month, 62, dt)
End If
End Sub
End Class
Made By: Yadav Roshani R. from Third Year of BCA
Comments
Post a Comment