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

Car travel expences

$
0
0
Hello I have tried my best in starting the program here is the code that I have started with but is not working I do not know why? I also need to ad an if statement to calculate if the millage is over that 100 then the price will be halved.

 
Public Class frmCar

    Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click
        Dim sngMileage As Single
        Dim sngRate As Single
        Dim sngTotal As Single
        'declaring the variables.
        sngMileage = CSng(txtMileage.Text)
        sngRate = CSng(txtRate.Text)
        sngTotal = CSng(txtTotal.Text)

        'formating the Total price for the destenation.
        txtTotal.Text = Format(sngTotal, "#0.00")

        'calculating the total.
        txtTotal.Text = CStr(sngTotal)
        txtTotal.Text = CStr(sngMileage * sngRate)



    End Sub


Viewing all articles
Browse latest Browse all 51036

Trending Articles