در این پست به شما آموزش خواهیم داد که چگونه دو زمان را با استفاده از کنترل DateTimePicker از هم تفریق کنید و مدت زمان بین این دو زمان را بدست آورید.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
Public Class TimeSpans_Form Private Sub Calculate_Button_Click(sender As Object, e As EventArgs) Handles Calculate_Button.Click Dim StartTime As DateTimePicker = Start_DateTimePicker Dim EndTime As DateTimePicker = End_DateTimePicker Dim StartedTime As New DateTime(StartTime.Value.Year, StartTime.Value.Month, StartTime.Value.Day, StartTime.Value.Hour, StartTime.Value.Minute, StartTime.Value.Second, StartTime.Value.Millisecond) Dim EndedTime As New DateTime(EndTime.Value.Year, EndTime.Value.Month, EndTime.Value.Day, EndTime.Value.Hour, EndTime.Value.Minute, EndTime.Value.Second, EndTime.Value.Millisecond) Dim Difference As TimeSpan = EndedTime - StartedTime Results_RichTextBox.Text = "Time Difference: " & Difference.ToString & vbNewLine _ & "Time Difference in Day(s): " & Difference.TotalDays & vbNewLine _ & "Time Difference in Hour(s): " & Difference.TotalHours & vbNewLine _ & "Time Difference in Minute(s): " & Difference.TotalMinutes & vbNewLine _ & "Time Difference in Second(s): " & Difference.TotalSeconds & vbNewLine _ & "Time Difference in MiliSecond(s): " & Difference.TotalHours End Sub Private Sub About_Button_Click(sender As Object, e As EventArgs) Handles About_Button.Click MsgBox("Powered By WWW.JustEducation.IR" & vbNewLine & "Danger:" & vbNewLine & "Do not copy to other sites; Just For Personal Uses!", MsgBoxStyle.OkOnly Or MsgBoxStyle.Information, "About") End Sub End Class |
[divide style=”dashs” icon=”circle” color=”#7100e2″]
تصاویر مراحل
[divide style=”dashs” icon=”circle” color=”#7100e2″]
تصاویر
[divide style=”dashs” icon=”circle” color=”#7100e2″]
بخش دانلود
[box type=”warning” align=”aligncenter” class=”” width=””]کپی برداری ممنوع می باشد![/box]
سلام
ممنونم فوق العاده بود.