From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Why do I get error -200088 when changing focus to some other window

Hello 

 

I am new to the .net style programming , so this is probably a stupid question, I am using Visual Studio 2010 and using USB-6008, I have digital read task, digital write tasks, analog in and out tasks, and everything works fine, except when the program is running in Visual Studio, or the .exe version, when you switch to some other window, like notepad, then switch back to my program it gives the error -200088 task is invalid.  It is like all the tasks are disposed when the focus is changed to some other window.  This even happens when debugging.  If I have a breakpoint set, when the program stops at the breakpoint, then you hit F5, all the tasks are invalid, and if you restart them they work fine again.  What am I doing wrong???

0 Kudos
Message 1 of 4
(4,375 Views)

Hi KLange,

 

Could you post a screenshot of the error you encounter?

 

 

Sunaina K.
Product Marketing Manager for CompactRIO & TSN

Making the intangible, tangible
0 Kudos
Message 2 of 4
(4,365 Views)

Thank you for the reply Sunaina,

 

I figured out what I was doing wrong.  We are migrating our programs from VB6.  In my VB6 programs, I have a subroutine " Form_Unload " that sets all analog and digital outputs off, then stops the tasks.  I tried to do the same thing in VS2010.  Here is the offending code.

 

Private Sub USB_DAQ_2010_01_UnLoad(sender As System.Object, e As System.EventArgs) Handles MyBase.Deactivate
 If (DigitalOutGroupBox.Enabled = True) Then ' Check to see if tasks have been stopped already
 USB_Read_Timer.Enabled = False
 TurnAllOutputsOff()
 stopMyTasks()
 End If
End Sub

 

Apparently this sub is called when the focus goes to another window, disposing if all the tasks.  

 

Thanks

KLange

 


0 Kudos
Message 3 of 4
(4,361 Views)

I am glad you got your program to work!

Sunaina K.
Product Marketing Manager for CompactRIO & TSN

Making the intangible, tangible
0 Kudos
Message 4 of 4
(4,353 Views)