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 :
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);
I tried google it said Here :
DataGridViewColumn column = dataGridView.Columns[0];
column.Width = 60;
How do I set to my datagrid ie; dgv
Please help, Thanks