在datagridview中为组合框分配值

时间:2014-03-12 20:01:37

标签: vb.net datagridview combobox

我在datagridview中填充了一个组合框。这很完美。我的问题是,如何在datagridview中为组合框分配特定值?我希望用户能够加载表单并显示已经显示的特定值,并选择已添加到组合框中的项目。

For Each row In Me.DataGridView1.Rows
        row.Height = 40
        row.DefaultCellStyle.WrapMode = DataGridViewTriState.True
        Dim dgvcombo As DataGridViewComboBoxCell
        dgvcombo = row.Cells(2)
        row.Cells(0).Value = tasknum
        row.Cells(1).Value = GetScalarData("SELECT duedate FROM task WHERE capaID = '" & CAPAid & "' AND task = '" & tasknum & "'")
        For i = 0 To x.Count - 1
            dgvcombo.Items.Add(x(i))
        Next

        tasknum = tasknum + 1
    Next row

非常感谢任何帮助。

谢谢

0 个答案:

没有答案