I am trying to get a handle to my form's textbox control from a class in the project, similar to this approach:
How to access Winform textbox control from another class?
I just cannot get it to work. Inside my form class I have this:
public Form1()
{
  InitializeComponent();
  id = new InputDevice(Handle, this);
  id.KeyPressed += new InputDevice.DeviceEventHandler(m_KeyPressed);
}
public void UpdateScanCode(string scanCode)
{
     txtScanCode.Text = scanCode;
}
Then inside my InputDevice class I have this:
Form mainForm;
public InputDevice( IntPtr hwnd, Form frmMain )
{
   ... stuff ...
   mainForm = frmMain;
}
...and finally, inside one of my functions:
mainForm.Update???
Intellisense cannot find the UpdateScanCode function, though it finds lots of other members of Form1. When I try mainForm.UpdateScanCode() it won't compile.
Why won't this work?
 
     
    