I have a combobox that has focus, if the user types, how can I prevent combobox from changing the selected index.
Say that I have a combo box with options "A" and "B", "A" is selected, and focus is highlighted in the combo box, if the user presses "B", the combo box changes to "B", as I prevent this?
The reason I want to do this is because I use a barcode scanner, and the drop-down list contains a list of printers, the selected printer prints something that scans the barcode scanner. Thus, if I drop out of the drop-down list and the barcode scanner sends input, it changes the selected printer.
This is the first solution I used: I used the keypress event in combobox and set the handled flag to true
private void comboBox_KeyPress(object sender, KeyPressEventArgs e) { e.Handled = true; }
But this solution does not work for Windows 98.
source share