4
Reply

column count property cannot be set on a databound c#

Jyoti Jodha

Jyoti Jodha

Apr 28 2017 4:13 AM
750

column count property cannot be set on a databound datagridview control c#

 
dataGridView1.ColumnCount = 7;
dataGridView1.Columns[0].HeaderText = "Product_ID";
dataGridView1.Columns[0].DataPropertyName = "Product_ID";
dataGridView1.Columns[0].Visible = false;
dataGridView1.Columns[1].HeaderText = "Name";
dataGridView1.Columns[1].DataPropertyName = "prodName";
dataGridView1.Columns[2].HeaderText = "Description";
dataGridView1.Columns[2].DataPropertyName = "_desc";
dataGridView1.Columns[3].HeaderText = "Tax_ID";
dataGridView1.Columns[3].DataPropertyName = "Tax_ID";
dataGridView1.Columns[3].Visible = false;
dataGridView1.Columns[4].HeaderText = "Unit_ID";
dataGridView1.Columns[4].DataPropertyName = "Unit_ID";
dataGridView1.Columns[4].Visible = false;
dataGridView1.Columns[5].HeaderText = "Tax";
dataGridView1.Columns[5].DataPropertyName = "Tax";
dataGridView1.Columns[6].HeaderText = "Unit";
dataGridView1.Columns[6].DataPropertyName = "UnitName"; dataGridView1.DataSource = dt;
}
 

Upload Source Code  Select only zip and rar file.
Answers (4)