Results 1 to 7 of 7

Thread: [RESOLVED] VB2010 Simple calc program needs help

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2010
    Posts
    10

    Resolved [RESOLVED] VB2010 Simple calc program needs help

    Hello All,

    This is my first post, so if I'm doing something wrong, please let me know. I'm brand-spanking new to programming and I need a little help. I bought a membership to learn visual studio.net and started with the beginner series. I'm less than a third of the way through the videos and started a little programming of my own. I need help finishing it off...

    Here is the code:
    Code:
    Public Class Form1
    
        Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
            Dim Mortgage As Double
            Dim Electricity As Double
            Dim gas As Double
            Dim SWgas As Double
            Dim Car As Double
            Dim Water As Double
            Dim Cable As Double
            Dim Trash As Double
            Dim CCB As Double
            Dim Income As Double
            Dim Xtra As Double
            Dim Phone As Double
            Dim Retire As Double
            Dim Save As Double
    
            Mortgage = Double.Parse(txtMortgage.Text)
            Electricity = Double.Parse(txtElectricity.Text)
            gas = Double.Parse(txtGas.Text)
            SWgas = Double.Parse(txtSWgas.Text)
            Car = Double.Parse(txtCar.Text)
            Water = Double.Parse(txtWater.Text)
            Cable = Double.Parse(txtCable.Text)
            Trash = Double.Parse(txtTrash.Text)
            CCB = Double.Parse(txtCCB.Text)
            Income = Double.Parse(txtIncome.Text)
            Xtra = Double.Parse(txtXtra.Text)
            Phone = Double.Parse(txtPhone.Text)
            Retire = Double.Parse(txtRetire.Text)
            Save = Double.Parse(txtSave.Text)
        End Sub
        Function calculateIncome(ByVal Income As Double, ByVal Xtra As Double) As Double
            Return Income + Xtra
        End Function
        Function calculateBills(ByVal Mortgage As Double, ByVal Electricity As Double, ByVal gas As Double, ByVal SWgas As Double, ByVal Car As Double, ByVal Water As Double, ByVal Cable As Double, ByVal Trash As Double, ByVal CCB As Double, ByVal Phone As Double, ByVal Retire As Double, ByVal Save As Double) As Double
            Return Mortgage + Electricity + gas + SWgas + Car + Water + Cable + Trash + CCB + Phone + Retire + Save
        End Function
        Function calculatePlaymoney(ByVal calculateIncome As Double, ByVal calculateBills As Double)
            Return calculateBills - calculateIncome
        End Function
        Sub displayNumbers(ByVal calculateIncome As Double, ByVal calculateBills As Double, ByVal calculatePlaymoney As Double)
            txtTotalincome.Text = Format(calculateIncome.ToString(), "Currency")
            txttotBills.Text = Format(calculateBills.ToString(), "Currency")
            txtLeftover.Text = Format(calculatePlaymoney.ToString(), "Currency")
        End Sub
    
    End Class
    I would really appreciate any help you all could provide. Not looking for gimme's, but some nudging in the right direction is/would be awesome. I've also included a screenshot of the form in case it helps...


    Thanks,

    Mike
    Attached Images Attached Images  
    Last edited by ttownfire; May 17th, 2010 at 11:46 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width