C# combox不能输入的解决方法

使Combox不能输入的两种方法。

方法一、 选择combox的    DropDownStyle = DropDownList    选择框不能输入。

方法二、

      (1)选择 combox的    DropDownStyle = DropDown;    

      (2)设置combox的  KeyPress事件

       private void cbDeviceType_KeyPress(object sender, KeyPressEventArgs e)
        {
            e.Handled = true;//取消输入事件
        }

猜你喜欢

转载自blog.csdn.net/bruce135lee/article/details/80251338