Attempting to do an assignment that has five input boxes, and then uses them to calculate how much money a person would make over the course of their working life.
The problem is, when i run it, it simply gives me how much the person would make after 1 year, with a raise included. The raise is ment to be given every year.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim Name As String
        Dim Salary, Total, Raise As Double
        Dim Age, Retire, Count As Integer


        Name = TextBox1.Text
        Age = TextBox2.Text
        Salary = TextBox3.Text
        Raise = TextBox4.Text / 100
        Retire = TextBox5.Text



        For Count = Age To Retire
            Total = Total + Salary
            Salary = Salary * Raise




        Next
        Label6.Text = Name & " will earn " & FormatCurrency(Total) & " before retiring. "

the for loop looks right to me, but i am very new to vb.

If you set Option Strict & Option Explict to On you would see many errors within this example. Besides the variable "Name" all other variables are numeric but you are assigning text values to them without first converting them to a numeric value. Remember textboxes hold text, even if a number is displayed within it, the program still see's it as text.

IE:

intAge = CInt(txtAge.Text)  'This will convert your text value to an integer

try this...

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim Name As String
        Dim AnnualSalary, RaisePercent, RaiseAmount, YearTotal, Total As Double
        Dim Age, Retire, Count As Integer
        Name = TextBox1.Text
        Age = TextBox2.Text
        AnnualSalary = TextBox3.Text
        RaisePercent = TextBox4.Text / 100
        Retire = TextBox5.Text

        For Count = Age To Retire Step 1
            YearTotal = AnnualSalary
            RaiseAmount = AnnualSalary * RaisePercent
            AnnualSalary = YearTotal + RaiseAmount
            TextBox6.Text = FormatCurrency(AnnualSalary, 2)
            Total = Total + YearTotal
            Me.Refresh()
        Next
        Label1.Text = Name & " will earn " & FormatCurrency(Total) & " before retiring. "
    End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.