Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Text To Decimal is not valid? Please help

$
0
0
The comments in the code explains what i am trying to achieve, however i keep getting an error which is

Conversion From String "06:18" to type Decimal Is Not Valid.

Any help will be much appreciated.

If txtStart.Text = "" Then
            chkTotalHours.Checked = False
            txtTotal.Text = "Enter Start Time"
        ElseIf txtFinish.Text = "" Then
            chkTotalHours.Checked = False
            txtTotal.Text = "Enter Finish Time"
        Else
            Dim StartWork As Decimal = txtStart.Text
            ' Time format = 24 Hour Format -> EG: txtStart.Text = 06:18
            Dim FinishWork As Decimal = txtFinish.Text
            ' Time format = 24 Hour Format -> EG: txtFinish.text = 17:27
            Dim TimeDifference As Decimal = FinishWork - StartWork
            ' Trying to subtract Finish Time from Start Time to work out the time difference
            ' In this case it is 11 Hours & 9 Minutes
            Dim HourlyRate As Decimal = txtHourly.Text
            ' This is the Rate Per Hour that you get paid - EG: $15.55
            Dim HoursDay As Decimal = TimeDifference * HourlyRate
            ' I am trying to work out how much for the day you get paid
            txtGross.Text = HoursDay
            ' This Displays the Monetary Gain
        End If


Thankyou

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>