📜  在 datagridview vb.net 中添加组合框 - 基本代码示例

📅  最后修改于: 2022-03-11 14:52:02.235000             🧑  作者: Mango

代码示例1
'To work as expected, set DataGridView AutoGenerateColumns to False
'end set all columns using your code, after DataGridView datasource property

Dim cmb As New DataGridViewComboBoxColumn()
cmb.HeaderText = "Options"
cmb.Name = "Col"
cmb.MaxDropDownItems = 2 'if needed
cmb.Items.Add("option 1")
cmb.Items.Add("option 2")

DataGridView1.Columns.Add(cmb)