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
The default columns are based on the data-type. I haven't checked, but for a link you could try exposing the data as Really, if you want a specific type of column - add the columns through code and set DataGridView.AutoGenerateColumns to Uri
, but that might be hopeful.false
.
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.
You can pre-create your columns in the designer. If the name of the column matches the name of the property the column will end up bound to, the databinding will take care of the DGV population for you as before.