I am new in vb.net i want to design a program that calculate Avg and StDev but this gives the error
Error 1 Statement cannot appear within a method body. End of method assumed"
Public
Class
Form1
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Function Stats (ByRef Data() As Double, ByRef Avg As Double, ByRef StDev As Double) As Integer
Dim i As Integer, Sum As Double, SumSqr As Double, Points As Integer
Points = Data.Length
For i = 0 To Points - 1
Sum = Sum = Data(i)
SumSqr = SumSqr + Data(i) ^ 2
Next
Avg = Sum / Points
StDev = System.Math.Sqrt(SumSqr / Points - Avg ^ 2)
Return (Points)
End Function
Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim Values(100) As Double
Dim average, deviation As Double
Dim Points As Integer
Points = Stats(Values, average, deviation)
Console.WriteLine(Points & " Values Proceed")
Console.WriteLine(" The average is " & average & " and ")
Console.WriteLine("the standard deviation is " & deviation)
End Sub
End Class