<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Two Dimensional Arrays in VB.NET' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Two Dimensional Arrays in VB.NET' posted on the 'VB.NET' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2010 Programmers Heaven</copyright>
    <pubDate>Mon, 15 Mar 2010 21:03:42 -0700</pubDate>
    <lastBuildDate>Mon, 15 Mar 2010 21:03:42 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Two Dimensional Arrays in VB.NET</title>
      <link>http://www.programmersheaven.com/mb/VBNET/408945/408945/two-dimensional-arrays-in-vbnet/</link>
      <description>I'd really appreciate it if anyone could help me out with two dimensional arrays. I am to enter a high and low temperature for five stations and find the average high and low. I understand that I need a two dimensional array to enter the values such as temp(5, 2) , and that I need to used a dual loop structure to enter the values, but I am having trouble figuring out how to initialize or execute the array. It is just a console application. Thanks for any suggestions. &lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/VBNET/408945/408945/two-dimensional-arrays-in-vbnet/</guid>
      <pubDate>Fri, 06 Nov 2009 19:18:53 -0700</pubDate>
      <category>VB.NET</category>
    </item>
    <item>
      <title>Re: Two Dimensional Arrays in VB.NET</title>
      <link>http://www.programmersheaven.com/mb/VBNET/408945/409098/re-two-dimensional-arrays-in-vbnet/#409098</link>
      <description>2 Dimensional Arrays are fairly straight forward&lt;br /&gt;
&lt;br /&gt;
When you define an array, generally you declare the size immediately. If you do not specify the starting cell value, it starts at 0.&lt;br /&gt;
&lt;br /&gt;
For instance:&lt;br /&gt;
Dim Arr(10) as String&lt;br /&gt;
&lt;br /&gt;
Arr has 11 cells. 0,1,2...10&lt;br /&gt;
&lt;br /&gt;
I could declare&lt;br /&gt;
Dim Arr(1 to 10) as String&lt;br /&gt;
&lt;br /&gt;
Arr now has 10 cells. 1,2,3...10&lt;br /&gt;
&lt;br /&gt;
The same thing goes for declaring a double dimensioned array&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
Dim Arr(4,1) As Double 'This will be big enough to handle your data
'We can immediately use the values inside
Arr(0,0) = 1.1
Arr(0,1) = 1.2
Arr(1,0) = 1.3 'Etc...
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
For your program, you want to enter a High and Low value 5 times... So you will want to use a loop to collect data, and at the end of the loop do the summing&lt;br /&gt;
&lt;br /&gt;
Here is an example, that will require you to read the comments and add additional code:&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
'I am not sure how you are inputting data through the console
'So read the comments carefully, they will instruct you on what code to add

Dim I as Integer = 0 
'We will use this to count the passes of the loop AS WELL AS
'determine the cell that we want to store data in

Dim WeatherData(4,1) as Double
'WeatherData(I,0) = Low Temp
'WeatherData(I,1) = High Temp

'Start a Loop here, it will repeat until the "While" condition is met

Do While I &amp;lt; 5
  Dim lowVal as Double = 0
  Dim highVal as Double = 0
  'Add code to wait for Low Input here, (lowVal = Input)
  WeatherData(I, 0) = lowVal

  'Add code to wait for High Input here, (highVal = Input)
  WeatherData(I, 1) = highVal
  I = I + 1 'This keeps us from getting stuck in an infinite loop
Loop

'Ok, so now we have all of the weather data
Dim SumLows as Double = 0
Dim SumHighs as Double = 0
For I = 0 to 4
  SumLows = SumLows + WeatherData(I, 0)
  SumHighs = SumHighs + WeatherData(I, 0)
Next I

'now you have the sum, you can do the average calculation
'and print the data to the console!!

&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Hope this helps,&lt;br /&gt;
Campbell&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/VBNET/408945/409098/re-two-dimensional-arrays-in-vbnet/#409098</guid>
      <pubDate>Wed, 11 Nov 2009 08:06:50 -0700</pubDate>
      <category>VB.NET</category>
    </item>
    <item>
      <title>Re: Two Dimensional Arrays in VB.NET</title>
      <link>http://www.programmersheaven.com/mb/VBNET/408945/409183/re-two-dimensional-arrays-in-vbnet/#409183</link>
      <description>Hi SeanCampbell,&lt;br /&gt;
&lt;br /&gt;
I guess you meant&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
SumHighs = SumHighs + WeatherData(I, 1)
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
in your last FOR NEXT loop.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Regards,&lt;br /&gt;
&lt;br /&gt;
Dr M&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/VBNET/408945/409183/re-two-dimensional-arrays-in-vbnet/#409183</guid>
      <pubDate>Thu, 12 Nov 2009 17:05:48 -0700</pubDate>
      <category>VB.NET</category>
    </item>
    <item>
      <title>Re: Two Dimensional Arrays in VB.NET</title>
      <link>http://www.programmersheaven.com/mb/VBNET/408945/409524/re-two-dimensional-arrays-in-vbnet/#409524</link>
      <description>Bless you guys...  this is the clearest I have seen this concept explained &amp;amp; I have been looking everywhere...  I am trying to teach myself VB.Net &amp;amp; arrays have really been giving me fits... I suspect I will need to be comfortable with them before I start trying to learn the database end of the deal, so I have really been putting lots of time in playing with arrays &amp;amp; trying to understand the 'why' behind each part of the process.&lt;br /&gt;
&lt;br /&gt;
Ruth&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/VBNET/408945/409524/re-two-dimensional-arrays-in-vbnet/#409524</guid>
      <pubDate>Wed, 18 Nov 2009 10:39:36 -0700</pubDate>
      <category>VB.NET</category>
    </item>
    <item>
      <title>Re: Two Dimensional Arrays in VB.NET</title>
      <link>http://www.programmersheaven.com/mb/VBNET/408945/409525/re-two-dimensional-arrays-in-vbnet/#409525</link>
      <description>Thanks for the Thanks Ruth.&lt;br /&gt;
&lt;br /&gt;
Surprisingly, we don't get a lot of thank yous in here :)&lt;br /&gt;
&lt;br /&gt;
You bring up a good point, I have been teaching a student how to program and there isn't a lot of information out there for the complete-noob... most assumes you have some programming knowledge already.&lt;br /&gt;
I was thinking about putting my information up as free tutorials on my website in the near future. This is encouraging ;)&lt;br /&gt;
&lt;br /&gt;
-Sean C</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/VBNET/408945/409525/re-two-dimensional-arrays-in-vbnet/#409525</guid>
      <pubDate>Wed, 18 Nov 2009 11:05:45 -0700</pubDate>
      <category>VB.NET</category>
    </item>
  </channel>
</rss>