I am using the begininvoke and endinvoke methods in visual studio 2005.
private: System::Void button_run_Click(System::Object^ sender, System::EventArgs^ e)
{
AsyncCallback ^ac = gcnew AsyncCallback(&InvokeTest::Form1::delegate_function_callback);
delegate_function ^df = gcnew delegate_function(this, &InvokeTest::Form1::function_to_invoke);
df->BeginInvoke(ac, df);
}
private: delegate int delegate_function(void);
public: int function_to_invoke(void)
{
label_status->Text = "Running";
//label_status->Text = "Stopped";
}
private: static System::Void delegate_function_callback(System::IAsyncResult ^asyncresult)
{
df->EndInvoke(asyncresult);
}
I get the following errors.
1. warning C4101: 'asyncresult' : unreferenced local variable
2. error C2065: 'df' : undeclared identifier
3. error C2227: left of '->EndInvoke' must point to class/struct/union/generic type
Any Ideas as to why it doesnt recognize df? or a different way to use EndInvoke for anyone with experience with it? Thanks.