agent4125
❔ Binding question for winforms DataGridView
I managed to do it with a listview in WPF, but can't see how it's done in winforms with a DataGridView. This is how I did it in WPF... GridViewColumn gcol = new GridViewColumn();
gcol.Header = "Name";
gcol.CellTemplate = template;
lvViewGridView.Columns.Add(gcol);
//////////////////////////////////////////////////////////////////////////////////
for (int i = 2; i < 10; i++)
{
gcol = new GridViewColumn();
gcol.Header = "Column " + i.ToString();
gcol.DisplayMemberBinding = new Binding("[col" + i.ToString() + "].Value");
lvViewGridView.Columns.Add(gcol);
}
12 replies