title: Datagridview Column width not changing
body: <p><a href="https://i.stack.imgur.com/yYFs3.png" rel="nofollow noreferrer">this is the property</a> | <a href="https://i.stack.imgur.com/9grBj.png" rel="nofollow noreferrer">this is the pic</a></p>
  
  <p>i cant seem to resize my column width in Datagridview. Here is my code:</p>
  
  <pre><code>      public void dgvwidth()
      {
          crud.FillDataGrid("Select ProductID,BrandName,Dosage from ProductItems", ref dgvOrderproductlist);
          dgvOrderproductlist.Columns[0].Width = 80;
          dgvOrderproductlist.Columns[1].Width = 250;
          dgvOrderproductlist.Columns[2].Width = 80;
      }
        private void HomePage_Load(object sender, EventArgs e)
      {
          dgvwidth();
      }
  </code></pre>
  
  <p>I'm trying to get just 3 columns from my table and change it column width to fit my Datagridview. its not getting any error but its not changing the column width as well.</p>
  
  <pre><code>    public void FillDataGrid(string sql, ref DataGridView dg)
      {
          try
          {
              DataSet ds = new DataSet();
              cn.Open();
              cmd = new SqlCommand(sql, cn);
              adptr = new SqlDataAdapter(cmd);
              adptr.Fill(ds);
              dg.DataSource = "";
              dg.DataSource = ds.Tables[0];
              dg.AutoResizeColumns();
  
          }
          catch (Exception e)
          {
              MessageBox.Show("" + e.Message);
          }
          cn.Close();
      }
  </code></pre>