Coding Compound Gear Ratio Program - Visual Basic

Ok, so I just started using Visual Basic this year and I’m trying to make a quick program for gear ratios. I have ran into some problems. I don’t know what to do now. btw this is for only compound gear ratios!

Gear1- 60
Gear2- 12
Gear3- 60
Gear4- 12
= 25

Doesn’t work:
= 0

Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click
Dim gear1 As Integer
Dim gear2 As Integer
Dim gear3 As Integer
Dim gear4 As Integer
Dim Ratio As Single
Dim reduction1 As Integer
Dim reduction2 As Integer
gear1 = CInt(txtGear1.Text)
gear2 = CInt(txtGear2.Text)
gear3 = CInt(txtGear3.Text)
gear4 = CInt(txtgear4.Text)
reduction1 = gear1 / gear2
reduction2 = gear3 / gear4
Ratio = reduction1 * reduction2
lblGearRatio.Text = Ratio.ToString
lblRed1.Text = reduction1.ToString
lblred2.Text = reduction2.ToString

    Catch ex As Exception
        MessageBox.Show("Please enter valid number")
    End Try
End Sub

I believe you need to have your reductions be floats (or singles or whatever you call them in visual basic) rather than integers because in your second example reduction 1 comes out to 1/5.

On a side note, you should use the code tags to post your code on the forum. They look like a pound sign/hashtag

Or just click the code button. :wink: