I am trying to create a DisplayAverage sub procedure that accepts 3 integer numbers as parameters. This procedure should find the average of these 3 numbers and display the numbers along with their average in the list box. I know im doing something wrong here I just cant figure out what. Thanks in advanced.
Private Sub btnAverage_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAverage.Click
Dim a As Integer = CInt(txtone.Text)
Dim b As Integer = CInt(txtTwo.Text)
Dim c As Integer = CInt(txtThree.Text)
Dim average As Double
average = (a + b + c) / 3
lstOutput.Items.Add(average.ToString())
End Sub
Sub DisplayMyName()
lstOutput.Items.Add("David Whitney")
End Sub
Sub DisplayAverage()
Dim a As Integer = CInt(txtone.Text)
Dim b As Integer = CInt(txtTwo.Text)
Dim c As Integer = CInt(txtThree.Text)
Dim average As Double
average = (a + b + c) / 3
lstOutput.Items.Add("The average of " & a & " and " _
& b & " and " & c & " is " & average)
End Sub
Private Sub btnAve_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAve.Click
lstOutput.Items.Clear()
DisplayMyName()
Dim a As Integer = CInt(txtone.Text)
Dim b As Integer = CInt(txtTwo.Text)
Dim c As Integer = CInt(txtThree.Text)
Dim average As Double
average = (a + b + c) / 3
lstOutput.Items.Add(average.ToString())
DisplayAverage()
End Sub
End Class