Thursday, December 15, 2011

Date and Time Difference user interface:








here is the CODE:

Public Class frmDateandTimeDifference

Private Sub btnGettheDifference_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGettheDifference.Click

Dim Diff1, Diff2, Diff3 As Long

Select Case cboSelect.SelectedIndex

Case 0
Diff1 = DateDiff(DateInterval.Year, dtpStartDate.Value, dtpEndDate.Value)
Diff2 = DateDiff(DateInterval.Month, dtpStartDate.Value, dtpEndDate.Value)
Diff3 = DateDiff(DateInterval.Day, dtpStartDate.Value, dtpEndDate.Value)
lblOutput.Text = Diff1 & " Year/s " & Diff2 & " Month/s " & Diff3 & " Day/s "

Case 1
Diff1 = DateDiff(DateInterval.Hour, dtpStartTime.Value, dtpEndTime.Value)
Diff2 = DateDiff(DateInterval.Minute, dtpStartTime.Value, dtpEndTime.Value)
Diff3 = DateDiff(DateInterval.Second, dtpStartTime.Value, dtpEndTime.Value)
lblOutput.Text = Diff1 & " Hour/s " & Diff2 & " Minute/s " & Diff3 & " Second /s "

End Select
End Sub

Private Sub frmDateandTimeDifference_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

cboSelect.Items.Add("Year, Month, Day")
cboSelect.Items.Add("Hour, Minute, Second")
End Sub

Private Sub Label6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label6.Click

Me.Close()
End Sub

End Class

**Run and Save the program.....

No comments:

Post a Comment