I am trying to access the MouseWheel events on my application main form, with much difficulty. There is no event handler in the properties and after much internet searching, it seems as if I have to manually create the event handler.
My code is :-
C#:
using System.ComponentModel;
using System.IO;
using System.Net.NetworkInformation;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using static System.Net.WebRequestMethods;
namespace Image_Viewer
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
this.MouseWheel += new MouseEventHandler(MainForm_MouseWheel);
}
But the compiler says

Am I missing a directive or something?
I have seen almost identical code posted on the internet, except using Form1 instead of MainForm

Cr BhargaviPosted Aug 17, 2023, 3:34 PM
Event handler method
MainForm_MouseWheelis missing. Please try adding that and run the code again, you would be able to have that issue fixedAmit MohantyPosted Aug 17, 2023, 12:31 PM
To fix this issue, you need to create the event handler method
MainForm_MouseWheelin yourMainFormclass.