I have a dataGridView. Now I want to add new columns to this and then set value for this columns. This my code
DataGridViewColumn texBoxColumn = new DataGridViewColumn();
DataGridViewCell cell = new DataGridViewTextBoxCell();
texBoxColumn .Name = "River's name";
texBoxColumn .ValueType = typeof(string);
texBoxColumn .HeaderText = "name of river";
texBoxColumn .CellTemplate = cell;
dataGridView1.Columns.Insert(0, texBoxColumn );
And then, I add value for this columns by query dataBase
for (int j = 0; j < dataGridView1.RowCount; j++)
{
dataGridView1[0, j].Value = "Hello";
}
The problem is, this columns still null, don't show anything. Any help? Thanks so much.