vb.net / DataGridView / ComboBoxCell?

我正在使用vb.net 2010和winforms以及DataGridView。 DataGridView有一个DataGridViewComboBox列。当我用DGV显示表单时,它显示了这个和空网格,但包含ComboBox的列显示了下拉列表中的第一个项目。 如果单击并选择ComboBox,我怎么能不显示?     
已邀请:
初始化时,尝试将combobox selectedindex属性设置为-1。这可能会解决您的问题,但是当我执行您描述的相同操作时,我的组合框中没有显示任何值,直到我点击它。以下是我采取的步骤:
1. create a datagridview control.

2. right click on control and add column.

3. add DataGridViewComboBoxColumn

4. right click on control and edit columns.

5. Click on the button for "Items (Collection)".

6. Add some items
现在你的控制应该按照你的要求行事。它运行时它工作正常。如果不是,它可能是VS2010错误,因为我正在运行VS2008。 编辑: 在代码中添加项目时,只需将组合框值设置为Nothing:
Dim cboBrand As New DataGridViewComboBoxColumn
With cboBrand
    .HeaderText = "Brand"
    .Name = "Brand"
    .Width = 300
    .Items.Add("item1")
    .Items.Add("item2")
    .Items.Add("item3")
End With

Me.DataGridView1.Columns.Insert(0, cboBrand)
DataGridView1.Rows.Insert(0, New Object() {Nothing})
或者如果要设置初始值,请执行以下操作:
DataGridView1.Rows.Insert(0, New Object() {"item2"})
    

要回复问题请先登录注册