Public Class Form1
Dim firstDate, msg As String
Dim secondDate As Date
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
firstDate = InputBox("Enter a date")
secondDate = CDate(firstDate)
msg = "Days from today: " & DateDiff(DateInterval.Day, Now, secondDate)
MsgBox(msg)
Catch ex As Exception
MsgBox("Stoppen?", MsgBoxStyle.Critical)
End Try
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Try
Dim date1
date1 = MaskedTextBox2.Text
TextBox2.Text = DateDiff(DateInterval.Day, Now, date1, FirstDayOfWeek.Monday) + 1 & " Dagen"
Dim code As Integer = 5988
TextBox3.Text = code + DateDiff(DateInterval.Day, Now, date1) + 1
Catch ex As Exception
MsgBox("Vul een datun in", MsgBoxStyle.Critical)
End Try
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox1.Text = Today
TextBox7.Text = TimeOfDay
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Try
Dim date1, date2
date1 = MaskedTextBox3.Text
date2 = MaskedTextBox4.Text
TextBox4.Text = DateDiff(DateInterval.Day, date1, date2) & " Dagen"
Catch ex As Exception
MsgBox("Vul een datum in", MsgBoxStyle.Critical)
End Try
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Try
Dim Tijd1, Tijd2
Tijd1 = TextBox7.Text
Tijd2 = MaskedTextBox1.Text
TextBox9.Text = DateDiff(DateInterval.Hour, Tijd1, Tijd2) & " Uren"
Catch ex As Exception
MsgBox("Geef een tijd op", MsgBoxStyle.Critical)
End Try
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Try
Dim Tijd1, Tijd2
Tijd1 = TextBox7.Text
Tijd2 = MaskedTextBox1.Text
TextBox9.Text = DateDiff(DateInterval.Minute, Tijd1, Tijd2) & " Minuten"
Catch ex As Exception
MsgBox("Geef een tijd op", MsgBoxStyle.Critical)
End Try
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Try
Dim Tijd1, Tijd2
Tijd1 = TextBox7.Text
Tijd2 = MaskedTextBox1.Text
TextBox9.Text = DateDiff(DateInterval.Second, Tijd1, Tijd2) & " Seconden"
Catch ex As Exception
MsgBox("Geef een tijd op", MsgBoxStyle.Critical)
End Try
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Label15.Text = TimeOfDay
End Sub
End Class