Question
Provided Code:
Public Class Form1
Private Sub btnExit_Click(sender As Object,
e As EventArgs) Handles btnExit.Click
Me.Close()
End Sub
Private Sub btnCalculateDueDays_Click(sender As Object, e As EventArgs) Handles btnCalculateDueDays.Click
End Sub
End Class
tick bitwise Or operation Work with dates and times Exercise 9-1 In this exercise, you'll use the Date Time and TimeSpan st I. Open the application th ructures. n that's in the CIVB 2015iChapter 09DateHandlin a form that accepts a future date a directory. Within this project, you'll find a birth date and provides buttons for calculating day clicks the Calculate Due Days button. Use the IsDate function to mak and the date entry is valid, and display the results in a message box likehu 2. Ad code to calculate the due days when the user enters a future date an Due Days Calculation Current date: 8/25/2016 Future date: 9/23/2016 Days until due: 29 ok 3. Test your code with a variety of date formats to see what formats can be successfully parsed. When you're done, close the form. Add code to calculate the age when the user enters a birth date and clicks the Calculate Age button. Use the IsDate function to make sure the date ent 4. valid, and display the results in a message box like this: ry is Age Calculation Current date: 8/25/2016 Birth date: 10/5/1947 Age 68 OK 5. Test your code to make sure it works for all dates. Then, close the solution.
Explanation / Answer
Private Sub btnCalculateDueDays_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles btCalculateDueDays.Click
Dim First As Date
Dim Second As Date
Dim Result As New TimeSpan()
First = ctype(txtBirthDate.text, date)
Second =ctype(txtFutureDate.text, date)
Result = Second - First
Me.TextBox1.Text = FormatNumber(Result.TotalDays.ToString, 2)
End S