DataGridView& ComboBox活动?

时间:2009-11-16 05:17:09

标签: vb.net winforms datagridview

使用VB.Net,我有一个带有ComboBox列的DataGridView。当用户更改ComboBox中的选择时,我甚至可以使用什么?

4 个答案:

答案 0 :(得分:2)

当选择了组合框值时,您可以执行此事件...

Private Sub dataGridView_EditingControlShowing(ByVal sender As Object, ByVal e As DataGridViewEditingControlShowingEventArgs)
    Try 
        If (Me.dataGridView.CurrentCell.ColumnIndex = CType(Column.Col,Integer)) Then
            Dim comboBox As ComboBox = CType(e.Control,ComboBox)
            If (Not (comboBox) Is Nothing) Then
                AddHandler comboBox.SelectedIndexChanged, AddressOf Me.ComboBoxIndexChanged
            End If
        End If
        Return
    Catch Ex As Exception
        Utils.ErrMsg(Ex.Message)
        Return
    End Try
End Sub

答案 1 :(得分:1)

SelectedValueChanged

答案 2 :(得分:0)

.FormatedValue,如Grid.Item.FormatedValue而非Value

答案 3 :(得分:0)

CurrentCellDirtyStateChanged - 然后测试您关注列中的当前单元格。