Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Task dispose only works from command button

Gentlemen,

 

The follow code I am using from a NIMax example works perfectly from the command button,  However if I call it from another subroutine or put it in a subroutine I get an error Specified task is unavailable or does not exist.  code -200088.  I tried a pause for 2 seconds before mytask.dispose but same error.

 

Help appreciated.

 

 If Not (runningTask Is Nothing) Then
            runningTask = Nothing
            myTask.Dispose()
           
        End If

 

George Masiello

0 Kudos
Message 1 of 2
(3,226 Views)

Hello,

 

The current code snippet does not provide enough information to make a conclusive suggestion. If you could post the complete subroutine and define some of your variables (runningTask, myTask) it would be helpful in troubleshooting the problem.

 

Given the information provided, the problem seems to stem from how a reference for the task is passed into the subroutine. It seems that your code does run properly when it is not in a subroutine. Have you passed the task reference into your subroutine? Also, where in your code is the error occurring?

 

Eric

Eric Liauw
Senior AE Specialist - Automated Test | CLD | CTA
National Instruments
0 Kudos
Message 2 of 2
(3,198 Views)