Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 695281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:56:35+00:00 2026-05-14T02:56:35+00:00

I have a form in VB.Net with Autoscroll enabled and several ComboBoxes within it.

  • 0

I have a form in VB.Net with Autoscroll enabled and several ComboBoxes within it. When I click on a ComboBox, I can use the mouse wheel to scroll through options, but I cannot deselect the ComboBox (by clicking off it on a blank portion of the parent form) in order to return to scrolling the parent form. This makes navigation in the form annoying, as I instinctively click off the control and flip the scroll wheel, causing the ComboBox to change selections instead of moving the parent form.

Is there a way to make this work in the intuitive way I expect it to, or do I have some conceptual confusion that makes this the wrong question to ask?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T02:56:35+00:00Added an answer on May 14, 2026 at 2:56 am

    Windows sends the WM_MOUSESCROLL message to the control with the focus. If the control doesn’t use it then it gets sent to the parent of the control. Eventually that will be your form which then uses it to scroll itself.

    ComboBox is however quite happy to use the message itself. When the dropdown is shown, it scrolls the dropdown list. It also captures the mouse so that it can see you clicking outside of the list. Which closes the list and keeps the focus on the ComboBox. Which then uses the message to scroll the items through the text box portion. In other words, when the CB has the focus, you’ll never get the scroll the form.

    You can mess with this by using IMessageFilter. My code in this thread shows an example. You’ll have to doctor it, the code was made to do something else. You can replace the m.HWnd field with the form’s Handle property value for example so all mouse scroll messages go to the form instead. Or you can use the code as-is, it is perhaps more intuitive.

    Be careful with this, your user might well be fatally confused by this non-standard behavior. Maybe she really wants to scroll the combo.

    Here is the code to make it work. Put it in your app’s main form, it is active for all other forms that your app shows:

    public partial class Form1 : Form, IMessageFilter {
        public Form1() {
            InitializeComponent();
            Application.AddMessageFilter(this);
            this.FormClosed += (o, e) => Application.RemoveMessageFilter(this);
        }
    
        public bool PreFilterMessage(ref Message m) {
            if (m.Msg == 0x20a) {  // Trap WM_MOUSEWHEEL
                var ctl = Control.FromHandle(m.HWnd);
                if (ctl == null || !(ctl is ComboBox)) ctl = Control.FromHandle(GetParent(m.HWnd));
                // Redirect when message destined for text box of a ComboBox
                if (ctl != null && ctl is ComboBox && !(ctl as ComboBox).DroppedDown) {
                    PostMessage(ctl.Parent.Handle, m.Msg, m.WParam, m.LParam);
                    return true;
                }
            }
            return false;
        }
    
        [System.Runtime.InteropServices.DllImport("user32.dll")]
        private static extern IntPtr PostMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp);
        [System.Runtime.InteropServices.DllImport("user32.dll")]
        private static extern IntPtr GetParent(IntPtr hWnd);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using web forms I know that you can only have one ASP.NET form on
I have an asp.net form with bunch of sections that can be expanded/collapsed and
I have form in my ASP.NET masterPage.master and if i click on submit it
I have a form in an ASP.NET MVC site which the user can edit
In my asp.net application I have a form where a user can pick a
Note: I am fairly new with ASP.NET I have a form with two ComboBoxes
If I have .Net Form with a component/object such as a textbox that I
I have asp.net form that contains fields. When I access this window, my javascript
I have an ASP.Net form and i would like to save it into a
I have a form that sits behind ASP.NET forms authentication. So far, the implementation

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.