Windows application with a user interface similar to the
following:
Place the radio buttons on a panel object so that only one
radio button can be checked.
Create a private DateTime object x.
Write a Form1_Load event handler that initializes the fields
on the form. The DateTime object x is initialized to the
current time and date according to the computers clock. Use
the Now method to do this. Then copy the date and time in x to
the Date and Time textbox.
The Reset button resets the textfields on the form to the
values shown above. It also sets the Move Forward radio button
to checked. Note: the click event handler for the Reset button
can be invoked in the Form1_Load event handler by invoking
btnReset.PerformClick().
When the Submit button is clicked, and the Move Forward
radio button is checked, add the amount of time shown in the
Seconds, Minutes, Hours, Days, Months, and Years textboxes
to the Date and Time textbox. Do this with these statements:
x = x.AddYears(txtYears.Text)
x = x.AddMonths(txtMonths.Text)
x = x.AddDays(txtDays.Text)
x = x.AddHours(txtHours.Text)
x = x.AddMinutes(txtMinutes.Text)
x = x.AddSeconds(txtSeconds.Text)
If the Move Backward radio button is checked, use these
statements:
x = x.AddYears(-txtYears.Text)
x = x.AddMonths(-txtMonths.Text)
x = x.AddDays(-txtDays.Text)
x = x.AddHours(-txtHours.Text)
x = x.AddMinutes(-txtMinutes.Text)
x = x.AddSeconds(-txtSeconds.Text)