0

I am developing a c# windows application where I use some combo box. When selecting an item for combo box, I want to move down to the page. So, I have used mouse scroll and while scrolling, the selected item of combo box is changed. please give me solution to stop mouse scrolling.

this.cmdtapchanger.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cmdtapchanger.FormattingEnabled = true;
this.cmdtapchanger.Items.AddRange(new object[] {
    "OFFCIRCUIT",
    "ON LOAD"});
this.cmdtapchanger.Location = new System.Drawing.Point(431, 80);
this.cmdtapchanger.Name = "cmdtapchanger";
this.cmdtapchanger.Size = new System.Drawing.Size(70, 21);
this.cmdtapchanger.TabIndex = 21;
this.cmdtapchanger.SelectedIndexChanged += new System.EventHandler(this.cmdtapchanger_SelectedIndexChanged);
  • Well. [this is a start](http://stackoverflow.com/questions/1882993/c-sharp-how-do-i-prevent-mousewheel-scrolling-in-my-combobox). It will not pass the scroll through to your form/panel though. You will need to find a way to handle that separately – musefan Jan 17 '17 at 09:25
  • @musefan But is it a dupe? – TheLethalCoder Jan 17 '17 at 09:27
  • 1
    Possible duplicate of [C# - how do I prevent mousewheel-scrolling in my combobox?](http://stackoverflow.com/questions/1882993/c-sharp-how-do-i-prevent-mousewheel-scrolling-in-my-combobox) – active92 Jan 17 '17 at 09:32
  • @TheLethalCoder: I don't think so exactly, because there is specific mention of the scroll needing to apply to the control behind the combobox – musefan Jan 17 '17 at 09:43
  • And adding some punctuation mark will make it easier for other to read your question. – cytsunny Jan 17 '17 at 10:09

2 Answers2

0

You should probably enable the focus property on the control Scrollbar. I mean add something like this at the end of your code:

ScrolBar1.Focus();
Dave
  • 3
  • 1
0

You should add one line of code to set the focus to scrollbar at the end of the SelectedIndexChanged event. here is an example,

    void YourComboBox_SelectedIndexChanged(object sender, EventArgs e)
    {
       //your code
       //...
       ScrollBar.Focus();
    }