title: Index out of range exception while inserting elements into a list
body: <p>I keep getting the following error:
  "Index was out of range. Must be non-negative and less than the size of the collection", while executing the following code:</p>
  
  <pre><code> try
          {
              string connectionstring = "server=localhost;user id=root;database=itemdb;password=root";
              MySqlConnection conn = new MySqlConnection(connectionstring);
              conn.Open();
              MySqlCommand cmd = new MySqlCommand("SELECT item.item_name,location.city,time.month,SUM(unit_sales) FROM sales_fact,time,item,location WHERE(sales_fact.item_key = item.item_key AND sales_fact.location_key = location.location_key AND sales_fact.time_key = time.time_key) GROUP BY item.item_name", conn);
              MySqlDataReader dr = cmd.ExecuteReader();
              int c = 0;
              List&lt;Cube1&gt; cubelist = new List&lt;Cube1&gt;();
              while (dr.Read())
              {
                  //i++;
                  cubelist[c].itemname = dr.GetValue(0).ToString();
                  cubelist[c].city = dr.GetValue(1).ToString();
                  cubelist[c].month = dr.GetValue(2).ToString();
                  cubelist[c].totalsales = (int)dr.GetValue(3);
                  MessageBox.Show(cubelist[0].totalsales.ToString());
                  c++;
              }
              dr.Close();
              MySqlDataAdapter da = new MySqlDataAdapter(connectionstring, conn);
              DataSet dt = new DataSet();
              da.Fill(dt);
              dataGridView1.DataSource = dt;
              conn.Close();
          }
          catch (Exception ex)
          {
              MessageBox.Show(ex.Message);
          }
  </code></pre>
  
  <p>Where I'm going wrong?</p>