Click here to Skip to main content
14,732,909 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a VB.Net application.

I have a datagridview, and I'm populating the datagridview using dataset.
I need to design the datagrid based on the columns available in the dataset.

Suppose in dataset I have 5 columns, in runtime that 5 columns will be displayed automatically.
But, with those 5 columns, I need to display 6th column as combobox column and 7th as checkbox column.

How to do this?
Updated 9-Dec-10 22:27pm
Dalek Dave 10-Dec-10 3:27am
Edited for Grammar and Readability.

1 solution

After setting datasource, you can add columns in datagridview as shown below,

DataGridView1.DataSource = dt

Dim comboColumn As New DataGridViewComboBoxColumn
DataGridView1.Columns.Insert(DataGridView1.Columns.Count, comboColumn)

DataGridView1.Columns.Insert(DataGridView1.Columns.Count, New DataGridViewCheckBoxColumn)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900