I have a DataGridView in a C# WinForms app that is DataBound at runtime (through Form_Load) to a custom Object.
In the design view of the DataGridView I have no columns set up.
When the Form loads the the columns are automatically created based on the data in the Custom object that it is DataBound to.
My question is how can I control the the Columns that are automatically created.
For example if I want one of the columns to be a DataGridViewLinkColumn instead of the DataGridViewTextBoxColumn that is automatically created?
I have a DataGridView in a C# WinForms app that is DataBound at runtime
Share
The default columns are based on the data-type.
I haven’t checked, but for a link you could try exposing the data asReally, if you want a specific type of column – add the columns through code and setUri, but that might be hopeful.DataGridView.AutoGenerateColumnstofalse.As Andrew implies; normally something like reflection is used to generate the columns, and you’ll get a column for every (browsable + public + readable) property. There is a layer of abstraction on top of this if you need, but this won’t help with adding a hyperlink column.