hi,
i am using sequential work flow, now i need to acess the reuslt from the workflow to the host(in my case windows forms).
i can access workflowcompletedeventargs , yes i can acess in the workflow completed event but i need those values to be set to my FORM (it si giving me thread exception) if i try to acess my form object in workflow completed event
can any one give me an example
thanks shankar.

how to access output parameters from workflow
Jacek U.
Docdoc
This is probably more of an issue with Windows Forms that workflow. You cannot update the form from a different thread, which is what you are trying to do if you are accessing it directly from the completed event handler. You need to use a delegate to invoke a method on the UI thread in order to update the form. The semi-pseudo code below should help get you most of the way there. The docs for winforms have more information on this stuff.
//this delegate will be used to interact with the formpublic delegate void MyDelegate(int workflowResult);
public void UpdateMyForm(int workflowResult)
{
if (MyForm.InvokeRequired)
{
// This code is executing on a different thread than the one that
// ...created the Form, so we need to use the Invoke method.
// Create an instance of the delegate for invoking this method
MyDelegate updateForm=new MyDelegate(UpdateMyForm);
// Create the array of parameters for this method
object[] args = new object[1] { workflowResult};
// Invoke this method on the UI thread
MyForm.Invoke(updateForm, args);
}
else
{
//do your actual form processing here
}
JohnGreer
Sai,
I have a workflow which has an int parameter as follows:
private int myVar;
public int MyProperty
{
get { return myVar; }
set { myVar = value; }
}
I set it to to the appropriate value in the workflow. On workflow completion, this variable is accessed as follows.
workflowRuntime.WorkflowCompleted += delegate(object sender, WorkflowCompletedEventArgs e)
{
waitHandle.Set();
Console.WriteLine(e.OutputParameters["MyProperty"]);
Console.WriteLine("foo");
}
Let me know if your scenario is similar and you are still getting the thread exception.
Thanks,
Vijay