【Winform】DataGridViewComboBoxCell的SelectIndexChanged事件
Private Sub Grid_EditingControlShowing(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) Handles Grid.EditingControlShowing
If Grid.CurrentCell.ColumnIndex = COL_HINCD Then
If Not (TypeOf (e.Control) Is ComboBox) Then Exit Sub
Dim cbo As ComboBox
cbo = TryCast(e.Control, ComboBox)
If cbo IsNot Nothing Then
RemoveHandler cbo.SelectedIndexChanged, AddressOf ComboBox_SelectedIndexChanged
AddHandler cbo.SelectedIndexChanged, AddressOf ComboBox_SelectedIndexChanged
End If
End If
End Sub
If Grid.CurrentCell.ColumnIndex = COL_HINCD Then
If Not (TypeOf (e.Control) Is ComboBox) Then Exit Sub
Dim cbo As ComboBox
cbo = TryCast(e.Control, ComboBox)
If cbo IsNot Nothing Then
RemoveHandler cbo.SelectedIndexChanged, AddressOf ComboBox_SelectedIndexChanged
AddHandler cbo.SelectedIndexChanged, AddressOf ComboBox_SelectedIndexChanged
End If
End If
End Sub
本作品采用 知识共享署名-非商业性使用 2.5 中国大陆许可协议进行许可。 |