title: DataTable automatically re-initializes itself
body: <p>Why does my <code>DataTable</code> automatically reset to <code>null</code> value inside of my event? </p>
  
  <p>After the <code>for</code> loop ends the <code>DataTable</code> resets to null and doesn't keep the value in the public field. Even though I have another event that does the same thing but it can hold the <code>DataTable</code>.</p>
  
  <pre><code>Public DataTable d = new DataTable();
  
  private void btnCSVgetter_Click(object sender, EventArgs e)
  {
      emptyDataGrid();
  
      var csv   = new OpenFileDialog();
      csv.Title = "Select CSV to Upload";
      csv.DefaultExt = "*.csv";
      csv.Filter = "CSV files| *.csv";
  
      if (csv.ShowDialog() == DialogResult.OK)
      {
          string safeName = csv.SafeFileName;
          string filename = csv.FileName;
          string filedirectory = csv.FileName.Substring(0, filename.IndexOf(safeName));
  
          if (IsFileLocked(filename)) { MessageBox.Show("File is in use by another user, close and try again"); return; }
  
          var con = new OleDbConnection(String.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=\"Text;HDR=YES;FMT=Delimited\"", filedirectory));
          var cmd = new OleDbCommand(String.Format("select * from [" + safeName + "]"), con);
          con.Open();
  
          var csvDA = new OleDbDataAdapter(cmd);
          var d = new DataTable();
  
          csvDA.Fill(d);
          DGVUpload.DataSource = d;
  
          con.Close();
          d.Columns.Remove("Symbol");
  
          foreach (DataColumn col in d.Columns)
          {
              if (col.ColumnName == "Ric Code")
                  col.ColumnName = "Symbol";
              else if (col.ColumnName == "AveragePrice")
                  col.ColumnName = "Avg_Price";
              else if (col.ColumnName == "Accounts")
                  col.ColumnName = "ClientAcct";
              else if (col.ColumnName == "Executed")
                  col.ColumnName = "Quantity";
  
          } // After this line datatable d resets to null
  
        // MoreCode...
   }
  </code></pre>