View Single Post
 
Old 12-03-2014, 06:51 AM
PlausiblyDamp's Avatar
PlausiblyDamp PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

Within a single method it isn't quite that straight forward unfortunately, C# would have flagged that as an error as average is an uninitialised variable and would have required you to set it to n initial value (e.g. 0). VB.Net is a bit more lax on these things and unfortunately this can lead to very subtle problems.

I would simply initialise the value at the point of declaration and that should sort things out.
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote