I have a DataGridView that gets a datasource assigned.
I would like to create my own columns if it’s (for example) DateTime.
I found an example of how you can create a DateTimePicker (here) (and hopefully also a NumericUpDown) to add to the datagrid, but I don’t know how i can define this column to my datagrid. Any help would be greatly appreciated!
I have a DataGridView that gets a datasource assigned. I would like to create
Share
Check the last method in your example:
This is where the columns are added to the
DataGridView. You can use the same way to add any column object derived fromDataGridViewColumnto your grid.[Edit]
Before binding, set the
DataGridView.AutoGenerateColumnsproperty tofalseand add your custom columns.You will also have to set the
DataPropertyNameproperty for each column, to define which property will be bound to which column: