calculation not how it must?
Posted: Sun Nov 19, 2017 11:46 am
Hello,
we have an combo with items from 01 till 59
it counts minutes
now we have 2 datepickers and when we select an hour from 2 datepickers
we like to get the results from when we pick a value from the combo
that all works fine but we don't get the result we like to have
for example:
datepicker1 has : 05:40 AM
datepicker2 has: 01:46 PM
now we get result of 8.06
we like to get when we select from combo like 46min
we must get the result of 7.60
but we get the result of 7.20
how do we fix it?
https://drive.google.com/open?id=1sEUGZ ... bMcB0icTMa
we have an combo with items from 01 till 59
it counts minutes
now we have 2 datepickers and when we select an hour from 2 datepickers
we like to get the results from when we pick a value from the combo
that all works fine but we don't get the result we like to have
for example:
datepicker1 has : 05:40 AM
datepicker2 has: 01:46 PM
now we get result of 8.06
we like to get when we select from combo like 46min
we must get the result of 7.60
but we get the result of 7.20
how do we fix it?
https://drive.google.com/open?id=1sEUGZ ... bMcB0icTMa
Code: Select all
tx = IDateTimePicker1.Value
tx1 = IDateTimePicker2.Value
tx1 = tx1.AddMinutes(-ComboBox1.Text)
endt = tx1.ToString("HH:mm:ss")
Dim HRS As TimeSpan
Dim _HRS As String
Dim St As TimeSpan = TimeSpan.Parse(stt)
Dim Cl As TimeSpan = TimeSpan.Parse(endt)
HRS = Cl - St
_HRS = HRS.ToString.Remove(5, 3)
_HRS = _HRS.ToString.Replace(":", ".")
If _HRS.StartsWith("0") Then
_HRS = _HRS.ToString.Remove(0, 1)
TextBox2.Text = _HRS
Else
TextBox2.Text = _HRS
End If