Trying to get the user to put 3 numbers in 3 text boxes and get the average.
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 Integer average = (a + b + c) / 3 lstOutput.Text = average End Sub
Try changing the type of average from Integer to Double
Right now you’re trying to store the Average in an Integer which can only hold a whole number. Averages tend to be non-whole numbers and need a data type that can represent that. Double is good for most situations. That should fix your problem.
EDIT OP mentioned that lstOutput is a ListBox
This is one of the confusing things with WinForms. Even though every single control has a Text property, not all of them actually do anything. They only apply to elements that directly display a single text block or value. Ex Button, Label, etc …
A ListBox on the other hand displays a group of items. You want to add a new item to the list.