C# – how to prevent mousewheel-scrolling in the combobox

ccomboboxmousewheel

I have a combobox and I want to prevent the user from scrolling through the items with the mousewheel.

Is there an easy way to do that?

(C#, VS2008)

Best Answer

Use the MouseWheel event for your ComboBox:

void comboBox1_MouseWheel(object sender, MouseEventArgs e) {
    ((HandledMouseEventArgs)e).Handled = true;
}

Note: you'll have to create event in code:

comboBox1.MouseWheel += new MouseEventHandler(comboBox1_MouseWheel);