Question

I want to have an event triggered when I scroll in my NumericUpDown. This code seems to ignore the scrolling when I'm inside a NumericUpDown:

public Form1()
{
    InitializeComponent();
    MouseWheel += new MouseEventHandler(mousewheel);
}

void mousewheel(object sender, MouseEventArgs e)
{
    System.Windows.Forms.MessageBox.Show("message");
}
Was it helpful?

Solution

    public Form1()
    {
        InitializeComponent();
        numericUpDown1.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.numericUpDown1_MouseWheel);
    }

    private void numericUpDown1_MouseWheel(object sender, System.Windows.Forms.MouseEventArgs e)
    {
        MessageBox.Show("hello");
    }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top