title: how to create dynamically adjust width of column of dynamically created datagridview in c# windows application
body: <p>I have dynamically created Datagrid , however I need to adjust width of columns, like I have Itemname its width should be 150 quantity should be 50 and so on.
  Heres my code for dynamic datagrid :</p>
  
  <pre><code>           dtitem = loadbl.itemonkot(dt.Rows[0][2].ToString());
              DataGrid dgv = new DataGrid();
              dgv.Location = new Point(3, 48);
              dgv.Width = 302;
              dgv.Height = 223;
              dgv.RowHeadersVisible = false;
              dgv.Font = new System.Drawing.Font("Microsoft Sans Serif", 10);
              dgv.DataSource = dtitem;
              grpbx.Controls.Add(dgv);
              grpbx.Name = "order";
              grpbx.Text = "Order";
              grpbx.Width = 311;
              grpbx.Height = 322;
              grpbx.Location = new Point(12, 12);
  </code></pre>
  
  <p>I tried google it said <a href="https://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcolumn.width.aspx" rel="nofollow">Here</a> :</p>
  
  <pre><code>DataGridViewColumn column = dataGridView.Columns[0];
  column.Width = 60;
  </code></pre>
  
  <p>How do I set to my datagrid ie; dgv</p>
  
  <p>Please help, Thanks</p>