怎么在datagridview里面添加combox?
小弟有这样一个问题,想在datagridview里面添加combox,但不是整个列都是combox那种,是像vb2005或者vb6.0控件的属性窗口那样,同一列中既有textbox又有combox,怎么实现呀?谢谢!
[解决办法]
如此这般:
Dim comboBoxCell As New DataGridViewComboBoxCell
comboBoxCell.Items.Add(xxx)
comboBoxCell.Items.Add(...)
......
Me.DataGridView1.Item(2, 2) = comboBoxCell '想设哪格就设哪格
但是要小心编辑完该格后有DataError()发生,把它屏蔽掉就可以了:
Private Sub DataGridView1_DataError(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewDataErrorEventArgs) Handles DataGridView1.DataError
Try
Catch ex As Exception
End Try
End Sub