Copyright Codenstuff.com 2017
YOU NEED TO BE LOGGED IN TO USE THIS FEATURE


Register
Credits
0
Reputation
0
calculation not how it must?
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.


User avatar
calculation not how it must?
calculation not how it must?
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 :D 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





Online now

Users viewing this forum: No registered users and 1 browsing

cron