M
Meya-awe
Anyone can tell me how to use control.Invoke or .BeginInvoke if i want
to pass some day from a non-ui thread to a ui thread?
Currently, i am using events into the UI module:
private void DataProcessingResults(object o, PresentationEventArgs args)
{
object[] argsData = new object[2];
argsData[0] = o;
argsData[1] = (object) args;
_instance.Invoke(new ResultsDelegate(PresentResults), argsData); // i
get a run-time error here
}
void PresentResults(object o, object[] argsData)
{
// code here maps argsData and extracts results.
}
delegate void PresentResults(object o, object[] argsData);
I get a run time exception on the invoke line from the site
MarshaledInvoke with exception message "Object type cannot be converted
to target type". As you can see, i am not using InvokeRequired property
since i want to bring scope back to the ui thread all together. Also,
_instance is defined as: "private static System.Windows.Forms.Form
_instance and is assigned before the Application.Run line in my code.
what do i need to do to avoid the exception?
thanks,
BRAMOIN
to pass some day from a non-ui thread to a ui thread?
Currently, i am using events into the UI module:
private void DataProcessingResults(object o, PresentationEventArgs args)
{
object[] argsData = new object[2];
argsData[0] = o;
argsData[1] = (object) args;
_instance.Invoke(new ResultsDelegate(PresentResults), argsData); // i
get a run-time error here
}
void PresentResults(object o, object[] argsData)
{
// code here maps argsData and extracts results.
}
delegate void PresentResults(object o, object[] argsData);
I get a run time exception on the invoke line from the site
MarshaledInvoke with exception message "Object type cannot be converted
to target type". As you can see, i am not using InvokeRequired property
since i want to bring scope back to the ui thread all together. Also,
_instance is defined as: "private static System.Windows.Forms.Form
_instance and is assigned before the Application.Run line in my code.
what do i need to do to avoid the exception?
thanks,
BRAMOIN