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!
Works:
Gear1- 60
Gear2- 12
Gear3- 60
Gear4- 12
= 25
Doesn’t work:
Gear1-12
Gear2-60
Gear3-12
Gear4-12
= 0
code:
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
Try
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