I have created a datatable with the required values
I have created a DataGRidViewTextBoxColumn:
In the DGV Paint event I have:
The column gets populated during the RowsAdded event;
I have tried both the .Add and the .Insert methods.
The column does not display.
I have created a DataGRidViewTextBoxColumn:
C#:
foodNameTable = [COLOR=#191970][B]CreateFoodNameTable[/B][/COLOR]();
foodNameColumn = [COLOR=#008b8b][B]new[/B][/COLOR] [COLOR=#191970][B]DataGridViewTextBoxColumn[/B][/COLOR]();
foodNameColumn.Width = [COLOR=#00008b]280[/COLOR];
foodNameColumn.HeaderText = [COLOR=#0000ff]"Eats"[/COLOR];
foodNameColumn.Name = [COLOR=#0000ff]"Eats"[/COLOR];
In the DGV Paint event I have:
C#:
dgvCats.Columns[[COLOR=#0000ff]"Id"[/COLOR]].Visible = [COLOR=#008b8b][B]false[/B][/COLOR];
dgvCats.Columns[[COLOR=#0000ff]"Name"[/COLOR]].Width = [COLOR=#00008b]280[/COLOR];
dgvCats.Columns[[COLOR=#0000ff]"Name"[/COLOR]].DisplayIndex= [COLOR=#00008b]0[/COLOR];
dgvCats.Columns[[COLOR=#0000ff]"Food"[/COLOR]].Visible = [COLOR=#008b8b][B]false[/B][/COLOR];
[COLOR=#008000]// dgvCats.Columns.Insert(1, foodNameColumn);[/COLOR]
dgvCats.Columns.[COLOR=#191970][B]Add[/B][/COLOR](foodNameColumn);
dgvCats.Columns[[COLOR=#0000ff]"Eats"[/COLOR]].DisplayIndex = [COLOR=#00008b]1[/COLOR];
dgvCats.Columns[[COLOR=#0000ff]"Eats"[/COLOR]].Visible = [COLOR=#008b8b][B]true[/B][/COLOR];
dgvCats.Columns[[COLOR=#0000ff]"BowlSize"[/COLOR]].Width = [COLOR=#00008b]65[/COLOR];
dgvCats.Columns[[COLOR=#0000ff]"BowlSize"[/COLOR]].DisplayIndex = [COLOR=#00008b]2[/COLOR];
dgvCats.Columns[[COLOR=#0000ff]"Name"[/COLOR]].ReadOnly = [COLOR=#008b8b][B]true[/B][/COLOR];
dgvCats.Columns[[COLOR=#0000ff]"Eats"[/COLOR]].ReadOnly = [COLOR=#008b8b][B]true[/B][/COLOR];
dgvCats.Columns[[COLOR=#0000ff]"BowlSize"[/COLOR]].ReadOnly = [COLOR=#008b8b][B]true[/B][/COLOR];
The column gets populated during the RowsAdded event;
I have tried both the .Add and the .Insert methods.
The column does not display.