Is somebody can help me with the following question?
How can I get the AVERAGE number from the column of ListView1.Items(ListView1.Items.Count - 1).SubItems.Add((reader("High").ToString) - (reader("Low").ToString)) and shows the AVERAGE number on the label.
Dim Cmd As SqlCommand = New SqlCommand(SelectCmd, conn)
Dim reader As SqlDataReader
reader = Cmd.ExecuteReader()
'**************************
Do While (reader.Read())
ListView1.Items.Add(reader("Id").ToString)
ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(reade("Date").ToString)
ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(reade("High").ToString)
ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(reader("Low").ToString)
ListView1.Items(ListView1.Items.Count - 1).SubItems.Add((reader("High").ToString) - (reader("Low").ToString))
Loop
'***************************
reader.Close()
conn.Close()
For example:
The column outputs will be:
1
3
5
2
8
________
Avg: 3.8
That will be the number i would like to have it on the label.
Thank you for your help!
Admin Edit: Please use code tags when posting your code. Code tags are used like so =>
Thanks,
PsychoCoder

New Topic/Question
Reply




MultiQuote






|