title: Trying to get a windows forms button to show the next 3 numbers in a text file
body: <p>As question indicates this is what I am trying to do can anyone see how been fiddling with it for a while. Currently it only shows the first 3 numbers in the text file, when I press the nextButton I want it to go to the next 3 but it does not seem to be working..</p>
  
  <pre><code>namespace GPSProject
  {
      public partial class Form1 : Form
      {
          private int count;
          internal dataPoints myDataPoints;
          public Form1()
          {
              myDataPoints = new dataPoints();
              InitializeComponent();
          }
  
          private void buttonNext_Click(object sender, EventArgs e)
          {
              {
                  Button b = (Button)sender;
                  if (b.Name.Equals("buttonNext"))
                  {
  
                      count++;
                      if (count == (myDataPoints.Count))
                          count = 0;
                  }
                  else
                  {
                      count--;
                      if (count &lt; 0)
                          count = myDataPoints.Count - 1;
                  }
                  dataPoint a = myDataPoints.getItem(count);
                  textBoxLatitude.Text = a.CurLatitude;
                  textBoxLongtitude.Text = a.CurLongtitude;
                  textBoxElevation.Text = a.CurElevation;
  
              }
          }
      }
  }
  </code></pre>
  
  <p>Above is my forms window and below is my dataPoints</p>
  
  <pre><code>namespace GPSProject
  {
      class dataPoints
      {
          public int Count { get { return Points.Count; } }
          List&lt;dataPoint&gt; Points;
          //string p;
  
          public dataPoints(/*string path*/)
          {
              Points = new List&lt;dataPoint&gt;();
             // p = path;
              TextReader tr = new StreamReader(/*p*/"C:/Test.txt");
              string input;
              while ((input = tr.ReadLine()) != null)
              {
                  string[] bits = input.Split(',');
                  dataPoint a = new dataPoint(bits[0], bits[1], bits[2]);
                  Points.Add(a);                
              }
  
              tr.Close();
          }          
  
  
  
          internal dataPoint getItem(int p)
          {
              if (p &lt; Points.Count)
              {
                  return Points[p];
              }
              else
  
                  return null;
          }
      }
  
  }
  </code></pre>