none
Why this exception occurs ? RRS feed

  • Question

  • Hi,
    In a Sequential workflow, in the codeActivity,  i want to copy the data string to the clipboard, but the code crash with an unhandled exception (Requested Clipboard operation did not succeed.)

    the data string has the right returned value.

    can anyone help me please ?

    thank you..


    ///////////////////////////////////////////////////
    code snippet
    private string data;

    private void codeActivity2_ExecuteCode(object sender, EventArgs e)
            {
                data = this.getControlValueTextZone.ControlValue;
                

                Clipboard.Clear();
                Clipboard.SetText(data);
            }

     

    System.Runtime.InteropServices.ExternalException was unhandled by user code
      Message="Requested Clipboard operation did not succeed."
      Source="System.Windows.Forms"
      ErrorCode=-2147221040
      StackTrace:
           at System.Windows.Forms.Clipboard.ThrowIfFailed(Int32 hr)
           at System.Windows.Forms.Clipboard.SetDataObject(Object data, Boolean copy, Int32 retryTimes, Int32 retryDelay)
           at System.Windows.Forms.Clipboard.SetText(String text, TextDataFormat format)
           at System.Windows.Forms.Clipboard.SetText(String text)
           at NotepadWF.Workflow1.codeActivity2_ExecuteCode(Object sender, EventArgs e) in C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\CCFNotepad\NotepadWF\Workflow1.cs:line 41
           at System.Workflow.ComponentModel.Activity.RaiseEvent(DependencyProperty dependencyEvent, Object sender, EventArgs e)
           at System.Workflow.Activities.CodeActivity.Execute(ActivityExecutionContext executionContext)
           at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(T activity, ActivityExecutionContext executionContext)
           at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(Activity activity, ActivityExecutionContext executionContext)
           at System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime)
      InnerException:


    Khaled92
    Monday, September 28, 2009 2:47 PM

All replies