I want to pass the control to the class as a parameter
for ex:
in class file, i have the below function:
public void DisableMouseRightClick(Control objControl)
{
var blankContextMenu = new ContextMenu();
foreach (Control control in objControl.Controls)
{
control.ContextMenu = blankContextMenu;
}
}
on form load, i have this:
foreach (Control ctl in this.Controls)
{
if (ctl is TextBox)
{
classFileObject.DisableMouseRightClick(ctl);
}
}
but it is not working.