using System.Runtime.InteropServices;
class Form1:Form
public int a = 0;
void BtnClick()
{
Test tt = new Test();
tt.handle = this.Handle;
tt.Do();
int nNewVal = a; // a = 9;
}
using System.Runtime.InteropServices;
using System.Windows.Forms;
class Test
{
public IntPtr handle;
public Test(){}
public void test()
{
Form1 form = (Form1)Form.FromHandle(handle);
form.a = 9;
}
}