views:

136

answers:

1

dim dt as new datatable
dt.columns.Add("Check", Type.GetType("System.Boolean"))

datagridview1.datasource = dt

A boolean type datacolumn a datatable, when bound to a datagridview automatically shows as DataGridViewCheckBoxColumn. With no code hassles

Inclusion of what type of datacolumn in the datatable will populate a DataGridViewComboBoxColumn similarly.

Any clues

+3  A: 

This isn't something a datacolumn type could really do automatically - a dropdown can be bound to different field types and display different field types. While you may see an ID column that links to another table - all it sees is the ID. If you want a dropdown in your datagridview, you're going to have to dispense with the automatic route and start writing the code to bind the dropdown value to one field in one table while telling it to display values from another, or use the designer.

CodeByMoonlight