title: Strange issue with a datagridview and a tabcontrol C#
body: <p>I have a strange problem. I have a <code>TabControl</code> with two <code>TabPages</code>. Each page has a <code>datagridview</code>. Both <code>datagridviews</code> are populated with <code>XML</code> files. </p>
  
  <p>I want to have the <code>AutoSizeColumnsMode</code> set to "<code>Fill</code>" for both <code>DataGridViews</code>. I want to set the width of columns in my code. </p>
  
  <p>And everything works fine for the <code>TabPage1</code> but setting width for the <code>DataGridView</code> on <code>TabPage2</code> throws the <code>NullReferenceException</code>.</p>
  
  <p>I really don't get it because I do the same thing as for <code>datagridview1</code> and there works fine but <code>datagridview2</code> throws the exception. Additionally, there is no exception if I choose any <code>AutoSizeColumnsMode</code> value but <code>Fill</code>.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>        XmlReader xmlFile = XmlReader.Create("File1.xml", new XmlReaderSettings());
          DataSet ds = new DataSet();
          ds.ReadXml(xmlFile);
  
  
  
              dataGridView1.DataSource = ds.Tables[0];
              dataGridView1.Sort(dataGridView1.Columns[1], ListSortDirection.Ascending);
  
             dataGridView1.Columns[0].Width = 35;
              dataGridView1.Columns[1].Width = 248;
              dataGridView1.Columns[2].Width = 110;
              dataGridView1.Columns[3].Width = 140;
              dataGridView1.Columns[9].Width = 127;
              dataGridView1.Columns[0].Visible = false;
              dataGridView1.Columns[1].Visible = true;
              dataGridView1.Columns[2].Visible = true;
              dataGridView1.Columns[3].Visible = true;
              dataGridView1.Columns[4].Visible = false;
              dataGridView1.Columns[5].Visible = false;
              dataGridView1.Columns[6].Visible = false;
              dataGridView1.Columns[7].Visible = false;
              dataGridView1.Columns[8].Visible = false;
              dataGridView1.Columns[9].Visible = true;
              dataGridView1.Columns[10].Visible = true;
              dataGridView1.Columns[10].Width = 100;
  
              xmlFile.Close();
  
          XmlReader xmlFile2= XmlReader.Create("File2.xml", new XmlReaderSettings());
          DataSet ds2 = new DataSet();
          ds2.ReadXml(xmlFile2);
          dataGridView2.DataSource = ds2.Tables[0];
  
  
              dataGridView2.Columns[0].Width = 135; // The exception is thrown here
              dataGridView2.Columns[9].Width = 200;
              dataGridView2.Columns[8].Width = 300;
              dataGridView2.Columns[7].Width = 70;
              dataGridView2.Columns[6].Width = 70;
              dataGridView2.Columns[5].Width = 124;
              dataGridView2.Columns[4].Width = 81;
              dataGridView2.Columns[3].Width = 70;
              dataGridView2.Columns[2].Width = 70;
              dataGridView2.Columns[1].Width = 124;
  
              dataGridView2.Columns[0].Visible = true;
              dataGridView2.Columns[1].Visible = true;
  
              dataGridView2.Columns[2].Visible = true;
              dataGridView2.Columns[3].Visible = true;
              dataGridView2.Columns[4].Visible = true;
  
              dataGridView2.Columns[5].Visible = false;
              dataGridView2.Columns[6].Visible = false;
              dataGridView2.Columns[7].Visible = false;
              dataGridView2.Columns[9].Visible = false;
  
  
              xmlFile2.Close();
  </code></pre>