【发布时间】:2015-03-28 00:10:38
【问题描述】:
我的 DataGridViewComboBoxCell 对象出现了一系列奇怪的问题。仅供参考,我使用的是单元格而不是列,因为我的数据是按行而不是按列组织的。
我的第一个问题是我似乎无法正确分配给我的 DataGridView。当我在我的代码中做一个直接的分配时很好:
Dim MyDropDown As New DataGridViewComboBoxCell()
'Code here to populate dropdown
MyForm.DataGridView1(col, row) = MyDropDown
当我尝试使用一个过程来做同样的事情时遇到了麻烦:
Dim MyDropDown As New DataGridViewComboBoxCell()
'Code here to populate dropdown
SetUpDataViewGridDropdown(MyDropDown, MyForm.DataGridView1(col, row))
。 . .
Public Sub SetUpDataViewGridDropdown(ByRef dd As DataGridViewComboBoxCell, _
ByRef ddTarget As DataGridViewCell)
ddTarget = dd
'Do some more interesting stuff here
End Sub
我没有收到错误,但 DataGridView 呈现时不显示下拉菜单。所以任务似乎没有发生。我错过了什么?
【问题讨论】:
标签: vb.net datagridview datagridviewcomboboxcell