Reputation: 170
I have a ComboBox. It is critical that the user cannot scroll by accident and change the selected value.
How can I prevent the ComboBox from changing the value and text when the use scrolls? Thanks.
Visual Studio 2008
Upvotes: 1
Views: 6439
Reputation: 980
combobox.MouseWheel += new MouseEventHandler(combobox_MouseWheel);
void combobox_MouseWheel(object sender, MouseEventArgs e)
{
((HandledMouseEventArgs)e).Handled = true;
}
Upvotes: 9
Reputation: 2008
If you don't want the user messing with the control, disable it. On another level however, if it's critical the user NOT use the control... maybe you should change the control.
ComboBox.Enabled = false;
Upvotes: 1