04-28-2012 04:30 PM
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???
04-30-2012 06:17 PM
Hi KLange,
Could you post a screenshot of the error you encounter?
05-01-2012 07:33 AM
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
05-02-2012 05:03 PM
I am glad you got your program to work!