Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 25th, 2004, 03:44 PM
Authorized User
 
Join Date: Aug 2004
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default Find average for values stored in an array

I am trying to figure out an easy way to find the average of all the values I have stored in an array.

Dim StoredValues(3) as integer
Dim AverageValue as integer

AverageValue = 'Code to return the average of the 4 values stored in StoreValues


Jeff Armstrong
Sr. Systems Mgr
SBC Services, Inc.
__________________
Jeff Armstrong
Sr. Systems Mgr
SBC Services, Inc.
 
Old October 29th, 2004, 09:55 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 109
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anubhav.kumar
Default

Hi Jeff,

I couldn't get the point, what you mean by easy way?
Loop through array , get the sum and divide by the upper bound. Do you mean something else?

Anubhav Kumar
 
Old October 29th, 2004, 10:05 AM
Authorized User
 
Join Date: Aug 2004
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I was hoping there was an average function. I know there is in VBA and I have used it numerous times. I am using something that sounds similar to what you just described only I'm just summing all items in the array and dividing by a counter that keeps track of how many times it goes through the loop to get all the values out of the array.


Jeff Armstrong
Sr. Systems Mgr
SBC Services, Inc.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Could Not find stored Procedure kavyach BOOK: ASP.NET Website Programming Problem-Design-Solution 1 June 10th, 2005 06:53 AM
Passing php array values to javascript array gkrishna Pro PHP 0 November 6th, 2004 03:20 AM
Could not find stored procedure ianmc BOOK: ASP.NET Website Programming Problem-Design-Solution 16 August 20th, 2004 03:40 PM
Could not find stored procedure 'sp_Polls_GetCurre jblp BOOK: ASP.NET Website Programming Problem-Design-Solution 1 September 18th, 2003 06:10 AM
find the average value from a column of values codespike Classic ASP Basics 2 August 15th, 2003 07:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.