Is there a elegant way, to bind predefined dataGridView columns with results from a SQL statement?
Example:
dataGridView1.Columns.Add(\"EID\", \"ID\");
d
I think the DataGridView has an AutoGenerateColumns
property, doesn't it?
dataGridView1.AutoGenerateColumns = True;
From the MSDN docs:
public bool AutoGenerateColumns { set; get; } Member of System.Windows.Forms.DataGridView
Summary: Gets or sets a value indicating whether columns are created automatically when the System.Windows.Forms.DataGridView.DataSource or System.Windows.Forms.DataGridView.DataMember properties are set.
Returns: true if the columns should be created automatically; otherwise, false. The default is true.
The property isn't on the Properties window though, you have to set it via code as in my example.