I'm coding in VC++.NET 2003. I have panels that will be populated with buttons dynamically. In my static callback function, I get an exception when I try to add the button to the panel.
//Exception: Controls created on 1 thread cannnot be parented to a control on a different thread
pnlDrawer->Controls->Add(b1);
Is there a workaround?
I want to add a button_click event for the new button, but a static function doesn't allow the this pointer. What can I use in place of the this pointer?
b1->add_Click(new System::EventHandler(this, Button_Click));
Thanks.