如何修复自动关闭的组合框

时间:2016-08-09 09:25:11

标签: c# vb.net combobox

我的获胜形式有组合框。当我第一次点击它。它自动关闭,之后我可以打开它并选择一个项目! 这对我来说是意外的!!

这是我的代码:

 Private Sub cmbType_Enter(sender As System.Object, e As System.EventArgs) Handles cmbType.Enter
        cmbType.DroppedDown = True
 End Sub


 Private Sub cmbType_Leave(sender As System.Object, e As System.EventArgs) Handles cmbType.Leave
        cmbType.DroppedDown = False
        cmbType.BackColor = Color.White
 End Sub

任何人都可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

通过选择SelectedIndexChanged事件来使用此代码: if(!comboBox1.DroppedDown)comboBox1.DroppedDown = true;